Average values from child work items

📚

This template calculated the average of a selected field’s values from all direct children of the current work item. Work items with an empty field are excluded from the calculation.

Configuration

To use the Average field values in sub-tasks template, simply select it from the template grid. Filter by Portfolio roll-ups & delivery KPIs to find it faster.

Parameters

To complete the configuration, select a field for the required parameter.

Edit formula mode

If you click on Edit formula you can see the Smart field in the Expression Parser. You can now tweak the expression to create a custom smart field based on this template.

Expression

General expression:

%{avg(filterByValue(fieldValue({issue.cfNNNNN}, (%{issue.issueType} = "Epic" ? issuesUnderEpic() : subtasks())), !=, null))}

NNNNN is the ID of the custom field you chose for the “Field” parameter.

Display as

Number

Formatting style

###,###.##

Used parser functions

The links lead to the JWTC documentation because the parser functions are shared functionalities.

Details

1. What does the expression do?

This expression calculates the average value of a selected custom field (cfNNNNN) across child work items:

  • If the current work item is an Epic: it averages the field values from all work items under the Epic.

  • If the current work item is not an Epic: it averages the field values from the work item’s sub-tasks.

In both cases, it ignores child work items where the field is empty.

Expression:

%{avg(filterByValue(fieldValue({issue.cfNNNNN}, (%{issue.issueType} = "Epic" ? issuesUnderEpic() : subtasks())), !=, null))}

2. Step-by-step breakdown

A) Choose which “child work items” to use

(%{issue.issueType} = "Epic" ? issuesUnderEpic() : subtasks())

This is a conditional (ternary) operator, meaning: IF condition THEN A ELSE B.

  • It checks: is the current work item type “Epic”?

    • Yes → issuesUnderEpic(): take all work items that belong to this Epic (e.g., stories, tasks, bugs).

    • No → subtasks(): take all sub-tasks of the current work item.

B) Read the field values from those child work items

fieldValue({issue.cfNNNNN}, <child list>)
  • {issue.cfNNNNN} is the custom field you configured (replace NNNNN with the real field ID, e.g. cf12345).

  • fieldValue(...) returns a list of values from the child work items, for example:

    • [3, 5, null, 8]

C) Exclude empty values

filterByValue(..., !=, null)
  • null means the field is empty / not set.

  • != null keeps only child work items where the field has a value.

  • Example: [3, 5, null, 8] becomes [3, 5, 8].

D) Calculate the average

avg(...)

Computes the mean of the remaining values:

  • avg([3, 5, 8]) = (3 + 5 + 8) / 3 = 5.33

E) Outer %{ ... }

Tells the Expression Parser to evaluate the whole formula and output the number.


3. Examples

Example 1: Current work item is an Epic

Custom field is cf12345 (“Story Points”). Work items under the Epic have:

  • Story 1: 3

  • Story 2: 5

  • Bug 1: (empty)

  • Task 1: 8

Average ignores the empty value:

  • Average = (3 + 5 + 8) / 3 = 5.33

Example 2: Current work item is not an Epic (e.g., a Task)

Sub-tasks have:

  • Sub-task A: 2

  • Sub-task B: (empty)

  • Sub-task C: 6

Average = (2 + 6) / 2 = 4


4. Real-life use cases

  • Estimate benchmarking: Show the average “Story Points” of stories under an Epic, or of sub-tasks under a standard work item.

  • Quality scoring: Average a numeric “Review score” or “Test result score” across child work items, ignoring those not rated yet.

  • Delivery metrics: Average numeric fields like “Cycle time”, “Effort hours”, or “Complexity score” across child work items, without empty values skewing the result.

If you share what cfNNNNN is in your Jira (e.g., Story Points, Cost, Hours), I can tailor the examples to match your actual field and units.