This template calculates the sum of a selected field's values from all direct children of the current work item.
Configuration
To use the Sum 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:
%{sum(fieldValue({issue.cfNNNNN}, (%{issue.issueType} = "Epic" ? issuesUnderEpic() : subtasks())))}
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 sums (adds up) the values of one chosen custom field (cfNNNNN) across child work items of the current work item:
-
If the current work item is an Epic: it sums the field across all work items under the Epic.
-
If the current work item is not an Epic: it sums the field across all sub-tasks of the current work item.
Expression:
%{sum(fieldValue({issue.cfNNNNN}, (%{issue.issueType} = "Epic" ? issuesUnderEpic() : subtasks())))}
2. Step-by-step breakdown
A) (%{issue.issueType} = "Epic" ? issuesUnderEpic() : subtasks())
This is a conditional (ternary) operator, which works like “IF … THEN … ELSE …”.
-
Condition:
%{issue.issueType} = "Epic"-
Checks whether the current work item’s type is Epic.
-
-
If true (it is an Epic):
issuesUnderEpic()-
Returns the list of work items that belong to the Epic (typically stories, tasks, bugs, etc. under that Epic).
Source (example usage and function reference on your site): Sum of time spent on epic and child work items
-
-
If false (not an Epic):
subtasks()-
Returns the list of sub-tasks of the current work item (the “normal” parent → sub-task relationship).
(This matches the approach used on your “Sum values from child work items” template page.)
-
So this part decides which “children” to look at, depending on whether you’re on an Epic or not.
B) fieldValue({issue.cfNNNNN}, <list of work items>)
-
{issue.cfNNNNN}is the custom field you want to sum (replaceNNNNNwith the actual field ID). -
fieldValue(...)collects that field’s value from each work item in the chosen list (either “under the Epic” or “sub-tasks”).
C) sum(...)
Adds all collected values together into one total.
D) Outer %{ ... }
Runs the whole calculation and outputs the final number.
3. Examples
Example 1: Current work item is an Epic
You choose custom field cf12345 = “Trucks needed”.
Work items under the Epic have:
-
Story 1: 2
-
Story 2: 3
-
Bug 1: 5
Result:
-
Sum = 2 + 3 + 5 = 10
Example 2: Current work item is not an Epic (e.g., a Task)
The Task has sub-tasks with:
-
Sub-task A: 1
-
Sub-task B: 4
Result:
-
Sum = 1 + 4 = 5
4. Real-life use cases
-
Epic roll-ups: Show total “Story points”, “Cost”, or “Planned effort” across all work items under an Epic.
-
Parent task roll-ups: For non-Epic work items, show totals from their sub-tasks (e.g., sum of “Work hours” across sub-tasks).
-
One smart field for multiple levels: Use the same field/formula on Epics and on standard work items, and it “does the right thing” depending on the type.
If you tell me what cfNNNNN represents in your setup (e.g., story points, costs, hours), I can tailor the examples and also point out any common pitfalls (like empty values or non-numeric fields).