Hello!
I need to calculate the percentage of related issues of a certain type and status to the total number of related issues of the same type. And then display the value in the calculated field.
To do this, I need to create an expression in a calculated field, but I don’t understand how to do this at all.
The formula should look like this:
Number of related tasks with a certain issuetype and status / total number of related tasks with this particular issuetype * 100
Help me please :)
Thanks, but for me it’s more priority to configure this through an expression rather than through automation
The expression would fill the custom field using automation.
It would kick-off your calculation and saving the result, keeping it up-to-date for you to enjoy...
more documentation on math expressions available in automation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's the automation that would gather two arrays of issues that are described in your formula, then using the .size operator you can construct the equation and store the outcome in a similar manner to this:
edit issue
customfield
{{#=}} {{lookupissuesA.size.divide(lookupIsssuesB.size).multiply(100)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the source of information for the expression you show? A rule may only have one Lookup Issues result at a time, so the above expression cannot work.
Instead a single lookup issue might be used with smart value, list filtering and a math expression, or repeated lookups could save intermediate results in created variables or with a lookup table. All of these depend upon which version of Jira (and automation rules) is used, and that information was not provided by the original poster.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill,
So it would be something similar to:
lookupissues = JQL query A
create variable SizeA = LookupIssues.size
Lookupissues = JQL query B
create variable SizeB = LookupIssues.size
followed by:
edit issue
customfield
{{#=}} {{SizeA.divide(SizeB).multiply(100)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, that is almost correct. The variables would need to be converted using asNumber before the inline math operation will work:
{{SizeA.asNumber.divide(SizeB.asNumber).multiply(100)}}
Although for this scenario, I instead recommend using smart value, list filtering with a math expression as it only requires one read of the issues from the database. When the issues gathered or the JQL are very different, the multiple calls to Lookup Issues seems better.
For example, this would produce the percentage completed by story points:
{{#=}}ROUND( ( 0{{#lookupIssues}}{{#if(equals(status.statusCategory.name,"Done"))}}+{{Story points|0}}{{/}}{{/}} ) / {{lookupIssues.Story points.sum|0}} * 100, 0){{/}}
How that works, working from inside to outward...
Additional criteria could be added using the other conditional logic functions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arina,
You can use an automation to do the math for you.
the lookup issues can be referenced using .size as is given in the Atlassian documentation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.