How to Calculate Percentage Complete based on timetracking of child issues

Jeffrey_Denton
Contributor
January 19, 2025

I've created an automation, manual trigger for now, and please avoid the logs as I was debugging.  I see the issue is on the Edit Issue Action.  

{{lookupIssues.timetracking.timeSpentSeconds.sum.divide(3600).divide(lookupIssues.timetracking.timeSpentSeconds.sum.divide(3600).add(lookupIssues.timetracking.remainingEstimateSeconds.sum.divide(3600))).multiply(100).round}}

It's providing an incorrect calculation of 900%.  Here is my audit log. screencapture-rk-industries-atlassian-net-jira-settings-automation-2025-01-19-21_32_39-edit.png

Here is my automation

screencapture-rk-industries-atlassian-net-jira-settings-automation-2025-01-19-21_34_39-edit (1).png

2 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 20, 2025

Hi @Jeffrey_Denton 

Short answer: I recommend using the longer math format for this calculation, such as with this:

{{#=}}ROUND( {{lookupIssues.timetracking.timeSpentSeconds.sum}} / ( {{lookupIssues.timetracking.timeSpentSeconds.sum}} + {{lookupIssues.timetracking.remainingEstimateSeconds.sum}} ) * 100, 0){{/}}

As a percentage is needed, dividing by 3600 for each value may be removed.

 

For the rule symptom...

I hypothesize there are two things causing the incorrect value: a racetrack error / order of processing, and inline math performing integer division.

  • Racetrack error / order of processing
    • Each of those lookups is iterating over the list of issues, then parsing the time tracking to sum the field, and then performing a division.  As that is happening three times within the single inline expression, it could be processing in an unexpected order.
  • inline math with integer division
    • The timetracking values in the expression are integers, and that typing is preserved, left-to-right in the processing.  This will cause both potential rounding errors (truncating up to 1799 seconds per value) and not produce the percentage expected as the value before the multiplication by 100 will be 0 or more (with no decimal digits).

 

Kind regards,
Bill

Jeffrey_Denton
Contributor
January 20, 2025

Bill, I plugged in the automation and it worked swimmingly.  thank you for cutting to the chase.  I'm going to take a minute to process my solution vs your solution and the information you presented.  Thank you!

Like Bill Sheboy likes this
0 votes
Ste Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 20, 2025

Hi @Jeffrey_Denton 

Can I clarify, what are you trying to calculate within the Automation Rule?

Is it the percentage of time left based on original estimate vs remaining estimate? Or is it based on time spent vs original estimate?

Ste

Jeffrey_Denton
Contributor
January 20, 2025

Thank you.  I'm trying to sum up all children task to get this equation:

Screenshot 2025-01-20 055143 JIRA.jpg

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events