This template displays the sum of the values from the Time spent field of the current epic and its child work items excluding sub-tasks.
If the current work item is not an epic, “None” will be displayed.
Configuration
To use the Time spent in epic and child work items template, simply select it from the template grid. Filter by Epic to find it faster.
Parameters
This template does not require any additional parameter configuration.
Expert mode
If you switch to Expert mode you can see the formula field in the Expression Parser. You can now tweak the expression to create a custom formula field based on this template.
Expression
General expression:
%{%{issue.issueType} = "Epic" ? sum(append(fieldValue({issue.timeSpent}, issuesUnderEpic()), [0])) / 60 : null}
If the resulting number from the expression contains too many decimal numbers, feel free to select one of the available display formats or to configure it manually.
Display as
Number
Formatting style
Default (unformatted)
Used parser functions
The links lead to the JWTC documentation because the parser functions are shared functionalities.
Details
1. What does the expression do?
The expression calculates the total time spent (in hours) on a given epic and all its child work items, excluding sub-tasks. If the current work item is not an epic, it returns nothing.
2. Step-by-step breakdown
Let’s break it down:
-
%{issue.issueType} = "Epic" ? ... : null
Checks if the current work item is an epic. If it is, the calculation proceeds; if not, it returns null (which displays as “None”). -
issuesUnderEpic()
Retrieves all child work items that belong to the current epic (excluding sub-tasks). -
fieldValue({issue.timeSpent}, issuesUnderEpic())
For each child work item under the epic, this gets the value from the "Time spent" field. -
append(..., [0])
Adds a zero to the list of time spent values. This ensures that if there are no child work items, the expression still works correctly and returns 0 instead of an error. -
sum(...)
Adds up all the time spent values (including the epic itself and its children). -
/ 60
Converts the total time from minutes to hours (since Jira stores time spent in minutes).
3. Examples
-
If you view an epic with three child work items, and their "Time spent" values are 120, 60, and 30 minutes, the calculation will be:
(120 + 60 + 30) / 60 = 3.5 hours -
If you view a standard work item (not an epic), the displayed result will be “None”.
4. Real-life use cases
-
Epic progress tracking:
Project managers can use this field to quickly see the total time spent on an epic and all its related work items, helping with reporting and resource planning. -
Sprint reviews:
During sprint reviews, teams can assess how much effort was invested in each epic, making it easier to evaluate progress and forecast future work. -
Time reporting:
For billing or internal reporting, this field provides a consolidated view of time spent on larger initiatives (epics), without needing to manually sum up each child work item.