This template displays the percentage of work items under an epic or a standard work item that have a resolution.
Configuration
To use this template, simply select it from the template grid.
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
Jira expression:
let children = (issue.isEpic ? issue.stories : issue.subtasks);
children.length ? (children.filter(child => child.resolution).length / children.length * 100 + '').slice(0, 4) + '%' : ''
Details
1. What does the expression do?
This expression calculates the percentage of child work items (either stories under an epic or subtasks under a standard work item) that have been resolved. It displays this percentage as a text value, such as "75%".
2. Step-by-step breakdown
Here’s the expression:
let children = (issue.isEpic ? issue.stories : issue.subtasks);
children.length ? (children.filter(child => child.resolution).length / children.length * 100 + '').slice(0, 4) + '%' : ''
Let’s break it down:
-
let children = (issue.isEpic ? issue.stories : issue.subtasks);-
This checks if the current work item is an epic.
-
If it is an epic, it uses
issue.stories(the stories under the epic) as the list of children. -
If it is not an epic, it uses
issue.subtasks(the subtasks under the work item) as the list of children.
-
-
children.length ? ... : ''-
This checks if there are any child work items.
-
If there are no children, it returns an empty string.
-
-
children.filter(child => child.resolution).length-
This filters the list of children to only those that have a resolution (i.e., are resolved).
-
.lengthgives the number of resolved child work items.
-
-
(children.filter(child => child.resolution).length / children.length * 100)-
This calculates the percentage of resolved child work items.
-
-
+ ''-
This converts the number to a string.
-
-
.slice(0, 4)-
This trims the string to the first 4 characters, to keep the percentage short (e.g., "75.0").
-
-
+ '%'-
This adds the percent sign to the end.
-
3. Examples
-
If an epic has 4 stories, and 3 of them are resolved, the calculation is:
-
3 resolved / 4 total = 0.75
-
0.75 * 100 = 75
-
Result: "75%"
-
-
If a standard work item has 2 subtasks, and both are resolved:
-
2 resolved / 2 total = 1
-
1 * 100 = 100
-
Result: "100%"
-
4. Real-life use cases
-
Progress tracking: Quickly see what percentage of an epic’s stories or a work item’s subtasks have been resolved, helping teams monitor progress.
-
Reporting: Use this field in dashboards or reports to highlight completion rates for larger work items.
-
Quality checks: Identify epics or work items where many child items remain unresolved, signaling potential bottlenecks.