/
Sum up worklog for child issues

Sum up worklog for child issues

 

Curious about the total effort required for the subtasks within a Story or the Stories within your Epic?

Leverage the Advanced Formula field, empowered by Jira Expressions, for seamless calculations without constraints.

Content

 

The formula

Jira Expressions provide a wealth of functions and properties for retrieving issue data. For instance, you can iterate over all subtasks to fetch field values and aggregate them. Consider the following formula:

issue.subtasks.reduce((result, issue) => result + (issue.timeSpent || 0), 0)

Let’s analyse this step by step

  1. issue.subtasks
    Returns a list of all subtasks (find more issue properties here: Jira expressions#issue)

  2. reduce(result, issue) => ..., 0)
    Helps you to iterate and aggreate values, where result is the sum and issue a subtask. 0 is the initial value of the aggregation (see Jira expressions#data-aggregation)

  3. issue.timeSpent || 0
    This retrieves the timeSpent Value in seconds (worklog) or if unset returns 0

 

Calculate for Epics

A quite similar formula can be used for child issues of an Epic

Instead of issue.subtasks you have to write issue.stories (see Jira expressions#epic)

issue.stories.reduce((result, issue) => result + (issue.timeSpent || 0), 0)

Make sure to only configure the field for Epics.

You may also use a check if the current issue is an Epic: issue.isEpic ? <do epic calculation> : 0

 

Related content