Summing up hours spent of subtasks in calculated field?

I have Storys & Tasks, some with time logged, some with Sub-Tasks which have time logged and sometimes a mix of both.

Now I am trying to add a calculated field on import from JIRA with the sum of logged time but I don’t know how to get the time logged within the subtasks. It seems, that iterating over the subtasks with

if(issue.fields.subtasks) {
      var sizeSubtasks = issue.fields.subtasks.length;
      for(var i = 0; i < sizeSubtasks; i++){
        if(issue.fields.subtasks[i].fields.timetracking) {
          if(issue.fields.subtasks[i].fields.timetracking.timeSpentSeconds) {
             sumTimeSpentSeconds = sumTimeSpentSeconds + issue.fields.subtasks[i].fields.timetracking.timeSpentSeconds;
          }
        }
      }
    }

doesn’t have the timetracking part of the subtasks:
2023-06-27 10_02_30-Window

I know that in this situation I can sum up the logged time within eazyBI but how can I get to these information within calculatedfields?

Hi, @Niklas

Sorry for not answering sooner.

As you mentioned, JSON doesn’t have the time tracking information of the subtasks; hence you won’t get it from there.

Two measures can help: “Hours spent” and “Hours spent with subtasks.” Please read more about them in our documentation: Jira Core measures and dimensions

If you have other questions related to eazybi don’t hesitate to ask here or directly to our support team: support@eazybi.com

Kindly,
Ilze support@eazybi.com

1 Like