Average work logged and duration of work

Hi all,

I need a report to calculate the average total of work logged on stories (including sub-tasks). All my searches are turning up suggestions on how to find the number of days an issue was in a status.

I would also like to report on duration, so from the date of the first worklog (though moved into a specific status could work) to the resolution date. We would also like an average of this.

Thanks!

Hi,

The exact solution for the calculation of the average Hours spent or Hours spent with sub-tasks per issues will depend on the exact design of the report. Perhaps, the universal solution is to create the custom measure using the “Avg” function for this purpose. For instance, if I would like to see the average number of hours spent per user you might use the following formula:

Avg(
  Filter(Descendants([Issue].CurrentMember,[Issue].[Issue]),
  [Measures].[Hours spent with sub-tasks]>0
  ),
  [Measures].[Hours spent with sub-tasks]
)

The report with this measure might look like this:

The solution of the custom cycle time (e.g., starting from the date of the first worklog till the resolution) would require creating a custom measure during the data import by the help of Javascript calculated custom field.

The advanced settings to calculate the cycle time as you mention would be like this:

[jira.customfield_cycle_ww]
name = "Cycle time new"
data_type = "decimal"
measure = true
javascript_code='''
if (issue.fields.worklog.worklogs[0] && issue.fields.resolutiondate) {
  datestart = Date.parse(issue.fields.worklog.worklogs[0].started);
  dateend = Date.parse(issue.fields.resolutiondate);
  if (dateend>datestart) {
    issue.fields.customfield_cycle_ww = (dateend-datestart)/1000/3600; //hours
  }
}
'''

After the data import, new custom measures will be created, and you will be able to build the average cycle time report from them:

Kindly,
Janis, eazyBI support

1 Like

Thanks, I have the average working. However i got an error when trying to import the cycle time measure. Just said “Error” under status.

Hi,

You should be able to click on the Error status link which should show the error message, perhaps it could explain the reasons for the error. Please, contact support regarding the error, we might need more details to tune the Javascript for your case.

Kindly,
Janis, eazyBI support

The correct Javascript needs one more check in the condition:

if (issue.fields.worklog && issue.fields.worklog.worklogs[0] && issue.fields.resolutiondate) {
  datestart = Date.parse(issue.fields.worklog.worklogs[0].started);
  dateend = Date.parse(issue.fields.resolutiondate);
  if (dateend>datestart) {
    issue.fields.customfield_cycle_ww = (dateend-datestart)/1000/3600; //hours
  }
}
'''

Kindly,
Janis, eazyBI support