Return the number of sub-tasks in the Done or Complete status.
Configuration
Create a Custom smart number field and use the General parsing mode.
Expression
%{count(filterByIssueType(filterByStatus(subtasks(), "Done, Completed"), "Sub-task,
Sub-story"))}
If you need to adapt this for other statuses or work item types, you can simply change the values in the expression (e.g., replace “Done, Completed” with other statuses, or “Sub-task, Sub-story” with other types).
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 number of sub-tasks that are in either the “Done” or “Completed” status and are of the type “Sub-task” or “Sub-story”. It returns this count as a number.
2. Step-by-step breakdown
Let’s break it down:
-
subtasks(): This function gets all sub-tasks (child work items) of the current work item. -
filterByStatus(subtasks(), "Done, Completed"): This filters the list of sub-tasks to only include those whose status is either “Done” or “Completed”. -
filterByIssueType(..., "Sub-task, Sub-story"): This further filters the already status-filtered sub-tasks to only include those of the type “Sub-task” or “Sub-story”. -
count(...): This counts the number of sub-tasks that meet both the status and type criteria. -
%{ ... }: This syntax is used to evaluate the expression and return the result.
3. Examples
Suppose a work item has the following sub-tasks:
-
Sub-task A: Status = Done, Type = Sub-task
-
Sub-task B: Status = In Progress, Type = Sub-task
-
Sub-task C: Status = Completed, Type = Sub-story
-
Sub-task D: Status = Done, Type = Sub-bug
Applying the expression:
-
Only Sub-task A and Sub-task C match both the status (“Done” or “Completed”) and type (“Sub-task” or “Sub-story”) criteria.
-
The result would be 2.
4. Real-life use cases
-
Project managers want to quickly see progress on sub-tasks of a particular kind (e.g., “Sub-story”) that are marked as done, without manually counting them.