Return the sum of the values of a specific field from the work items returned by a JQL query.
Configuration
Create a Custom smart number field and use the General parsing mode.
Expression
%{sum(fieldValue({issue.cf10024},
issuesFromJQL("project = DEMO
and 'fieldName' is not empty")))}
Please, replace nnnnn in the above expression with the ID of the Number custom field and fieldName with its name. Additionally, replace the DEMO project key with the corresponding project key of your project
This expression can be customized to limit the work items from which the values are obtained by modifying the JQL query in the issuesFromJQL() parser function.
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?
This expression calculates the total value of a specific field from all work items that match a given JQL query.
2. Step-by-step breakdown
Let’s break it down:
-
issuesFromJQL("project = DEMO and 'fieldName' is not empty")-
This part runs a JQL (Jira Query Language) search to find all work items in the "DEMO" project where the specified field is not empty.
-
You can change the project key and field name to match your needs.
-
-
fieldValue({issue.cfnnnnn}, ...)-
For each work item found by the JQL query, this function retrieves the value of a specific custom number field.
-
Replace
nnnnnwith the actual field ID of your custom Number field.
-
-
sum(...)-
This function adds up all the values retrieved by
fieldValuefrom the list of work items.
-
-
%{ ... }-
This syntax is used to interpret the elements within as functions.
-
3. Examples
Suppose you want to sum the "Story Points" field (custom field ID 10024) for all work items in the "SALES" project where "Story Points" is not empty. The expression would look like:
%{sum(fieldValue({issue.cf10024}, issuesFromJQL("project = SALES and 'Story Points' is not empty")))}
If there are three work items with "Story Points" values of 3, 5, and 8, the result would be 16.
4. Real-life use cases
-
Sprint Planning: Sum up the total story points for all work items in a sprint to estimate team workload.
-
Budget Tracking: Add up the values of a "Budget" custom field for all work items in a project to see total planned spending.