SubTask Completion Percentage

Samuel Smiles P June 16, 2020

 

Hi,

I want to get the completion percentage of subtasks for all the parent issues, I just need the percentage to be displayed for all the parent issues rather than me going in  and manually checking for each and every parent issue. Is there a way? By custom field or export to excel or PDF or a dashboard gadget or by using automation rules or Rest API's.

Screenshot (3).png

 

Please explain me if there is a way to achieve this.

 

Thanks

 

3 answers

1 accepted

3 votes
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.
June 16, 2020

Hi @Samuel Smiles P 

Unfortunately this isn't built into JIRA (out of the box) in a way to use as you have asked.  It is probably only worth solving if you have a lot of sub-tasks.

You listed a couple of options that would work: export to Excel, or automation rules.  In addition, if you have one of the marketplace JQL scripting add-ons, you can use that instead.

For Excel, you would build a spreadsheet to correlate the parent/child relationships, and roll up the data by status or status category.  Then regularly export the data and paste it into your spreadsheet to process it.

For automation rules, you would maintain your own counts.  It will be busy and noisy in alerts, but it could work.

  • Add custom fields (number type) for todo, in progress, and done sub-task counts.  Maybe also add another for percent done.
  • Build a rule #1 to update the counts
    • Trigger on status change
    • Add a condition for issuetype of sub-task
    • Branch on parent
    • Reset all the counts and percent done
    • Branch on sub-tasks of the parent
    • Increment the counts for the status (or status category) of each sub-task
    • And some triggering value to recompute the percent done, such as a comment in the parent
  • Build a rule #2 to update the percent done
    • Set the rule option to be triggerable by other rules
    • Watch for the trigger created by rule #1
    • Compute the percent done and save it

If you need this periodically, and not up to date every minute, I would use the Excel approach.

 

Best regards,

Bill

Samuel Smiles P June 22, 2020

Hi Bill_Sheboy,

 

Thanks for your reply.

 

I think excel will work, can you please explain me how to get the subtask percentage number of all the parent issues in a spread sheet?

 

Regards,

Sam

Like John Funk likes this
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.
June 22, 2020

Hi Sam,

Here is an outline of an Excel approach.  Please adjust based on what you want.  For example, what do you mean by "% complete"?

  • First, make a query with the data/project you want to consider, including all issue types
  • Export this data, and put it in a spreadsheet tab/worksheet.  Let's call this tab JIRA.
  • Sort the data by Key. Sorting again is important as your spreadsheet may use a different sort than JQL.
  • Add another tab/worksheet, listing the parent items you want to report, including their Issue Key and Issue ID.  Let's call this tab REPORT.
  • On the REPORT tab...
    • Add a column to count children not started, with a formula such as: COUNTIFS(JIRA!column with Parent Id, REPORT!parent's Issue Id, JIRA!column with Status Category, "To Do")
    • Repeat above, adding columns for "In Progress", and "Done"
    • Decide how to measure "% complete" and create a formula for it.

It may end up looking like the below image

Best regards,

Bill

 

Like John Funk likes this
Samuel Smiles P June 23, 2020

Thank you very much Bill.

David Woo April 18, 2022

Hi Bill, increment count for each subtask, are you using JQL for that? 

Like John Funk likes this
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.
April 19, 2022

Hi @David Woo 

I cannot tell if you are using Jira Cloud or Server/Data Center...so let's assume Cloud for now:

First, I would use a Lookup Issues action to gather all of the subtasks for the parent using JQL: https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Lookup-issues

Then, using smart value, list filtering on the desired status value (or other fields), prune down to the desired results to produce a list that can be counted.  https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

Another alternative is to use Lookup Issues repeatedly with your specific criteria ( e.g. "Epic Link" = {{triggerIssue.Epic Link}} AND status = "In Progress" ) and store each result in a Created Variable to use later.  https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-variable

Kind regards,
Bill

Like John Funk likes this
David Woo April 19, 2022

Hi Bill,  I am using the CLOUD version.  I have the Rule in place, but what I have noticed is that the value seems to capture from when the last rule ran, which is odd.  I created three fields to capture Task Done, total Task and Percentage Completed.

So, when an issue is set to DONE, the rule is trigger.
It verifies the issueType is a sub-task
Then it branch into its parent (screenshot attached)
I have it set the three fields to EMPTY (This is where I see the first problem since the next step is to create a comment with those field and they don't go to Empty.

I then un a lookup issue search which returns me the number of issues that are Done and update the V Total Issues Done field
I do the same with getting the total issues count and update the V Total Issues Count field.

And last, I calculate both fields*100 for the Percentage Completed Fields:
{{issue.v Total Issues Done.divide(issue.v Total Issues Count)}}*100

And last, I output all fields into the comments to compare value and for some odd reason, the numbers don't match even thought they are the exact field names used.

 

Thoughts?RulePercentageCompleted.gif

The output looks wonky, since the RAW value is correct in the top half, but the comments and percentage completion has been getting its value from the previous run of the RULE.

RuleOutput.gif

Like John Funk likes this
David Woo April 19, 2022

After creating 2 variables (one for Done, the other for Count). it got me closer, the numbers match up now which is great.  But for some odd reason, it is complaining about :

Could not convert the field value to a number. Please ensure the value is a number, math expression or smart-value that can be converted into a number.

I tried TotalIssuesDone.value with no success to see if a numeric value is produced.  Thoughts?

 

CustomVariable.gif

Like John Funk likes this
David Woo April 19, 2022

Thank you Bill S.  

 

Your additional information helped me to figure this out.  By leveraging the asNumber call, I now get the percent completed value:

{{#=}}{{TotalIssuesDone.asNumber}}/{{TotalIssuesCount.asNumber}}*100{{/}}

 

I got it now.  I am now going to see about converting this back into a string so I can put a % symbol after it.  Thank you.  

Like John Funk likes this
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.
April 20, 2022

You may use the function asPercentage to do that:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/#asPercentage

Please note...

Also I noticed that you were clearing fields in a rule with edit, and then editing again.  Rules always start an edit from the data values at load time when the rule triggered.  If you want the updated values used, try including a Re-fetch action.

For example from a made up scenario:

  • when the rule starts an issue's field = 123
  • ...
  • action: edit an issue's field to ABC (Result: the copy in the Cloud is ABC and the rule still stores it as 123)
  • action: Re-fetch
  • ...Now, the rule and Cloud-stored value match: ABC

My understanding is Re-fetch only applies to the issue(s) from the trigger, and not any branches.

Like John Funk likes this
0 votes
Luka Hummel - codefortynine
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 10, 2023

Hi @Samuel Smiles P

I think our app Dynamic Custom Fields for Jira would be perfect for your use case.

The app allows you to create custom fields that have their values automatically calculated based on a Jira expression you provide.

I have quickly thought of an expression that would display the percentage of all completed subtasks.

let subtaskTotal = issue.subtasks.length;
let subtaskDone = issue.subtasks.map(s => s.status.category.key).filter(k => k == "done").length;
subtaskTotal > 0 ? subtaskDone / subtaskTotal * 100 + "%": ""

2023-08-10 17-12.png 

You could also just display it as a number custom field without the "%" if you want to use the field value for further calculations.

Let me know if this would work for you :)

0 votes
Reshma Ulvekar July 5, 2023

Hi Bill,

I have Jira Data Center instance where LookUp issue won't work,

Can you please help me how can i achieve this in Jira Data center version for calculating % completion of child issue?

Regards,

Reshma.

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.
July 5, 2023

Hi @Reshma Ulvekar 

Lookup Issues is currently in progress for adding to Server/ Data Center, and you can watch progress here: https://jira.atlassian.com/browse/JIRAAUTOSERVER-53

Until then, would you please confirm what you are trying to measure; that is, what do you mean by % completion for a child issue?

Server / Data Center work-arounds for similar scenarios often use the scheduled trigger with bulk-handling option enabled to substitute for Lookup Issues.  Please look here to learn more about that: https://confluence.atlassian.com/automation/run-a-rule-against-issues-in-bulk-993924653.html

Kind regards,
Bill

Like John Funk likes this
Reshma Ulvekar July 6, 2023

Hi Bill,

I basically want epic to show the % completion of the story point which are moved to "done" state.

I have automation rule to sum up all the story points which are moved to "done" state and add to epic, but i am unable to figure out how to get % of story point  which are move to "done" state. 

Regards,

Reshma. 

Like John Funk likes this
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.
July 6, 2023

What do you mean by "show the % completion"?

For example if you wanted to send a message/email, you could use the bulk-handling feature of branches and smart value, list filtering, and math functions to calculate the sum of story points for done issues divided by the total.

If instead you want to update a field in the epic (for later reporting usage), your options are limited by the rule trigger you use.  One slower work-around is to call the REST API with a JQL search, as this will emulate the behavior of Lookup Issues for gathering the issues for the math operation.

Like John Funk likes this
Reshma Ulvekar July 6, 2023

Hi Bill, 

Suppose I have 2 story in an epic each having story points in it. 

Story 1: 50 story points

Story 2 :50 story points

Story 1 is completed and moved to "done" State. Now epic should have field "℅completion" Which should say 50℅. 

Can you please help me with how can I achieve this scenario?Is there and math formula which can be used for this? 

Regards, 

Reshma

Like John Funk likes this
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.
July 7, 2023

There are at least a couple of approaches, as I noted earlier...

(1) You noted that you already have a rule to sum up the story points for issues in the epic moved to done.  Let's assume you are storing that in a field in the epic.  You could duplicate that rule so it includes all the issues, not just the completed ones.  And then use the math operations, as described here: https://confluence.atlassian.com/automation/jira-smart-values-math-expressions-993924866.html

For example, if your epic fields were named TotalStoryPoints and TotalCompletedStoryPoints a math expression could be:

{{issue.TotalCompletedStoryPoints.divide(issue.TotalStoryPoints).multiply(100)}}

And then use the other math operations to adjust the precision display, as needed.

 

(2) Or...you could call the REST API to perform an issue search with JQL.  This will return all the issues in epic in a web response, with the fields you want to use.  Then use math operations and smart value, list filtering to select the completed versus total story points.

Here are some references to help trying that method:

https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

https://support.atlassian.com/jira-work-management/docs/use-advanced-search-with-jira-query-language-jql/

https://confluence.atlassian.com/automation/jira-automation-actions-993924834.html

https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

Like John Funk likes this
Reshma Ulvekar July 7, 2023

Hi Bill, 

Thanks for your suggestion. 

I am able to get % done value with the math formula shared. 

It shows as 8.100.

Is there any formula to shows as 81%?

Regards,

Reshma

Like John Funk likes this
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.
July 7, 2023

What are the two values used which led to 8.100 for your "done story points" and "total story points"?  Those may indicate where there is a problem.

And, you may also use the ROUND function to get the precision that you want, and add the percent sign to the end as text.  Please look here for more information about that function: https://confluence.atlassian.com/automation/jira-smart-values-math-expressions-993924866.html

Like John Funk likes this
Reshma Ulvekar July 10, 2023

HI Bill,

I tried using below math expression to get percentage value. 

{{issue.Story Points.asPercentage}}

But it gave error stating "Could not convert filed value to number, math expression " 

Story Points : 8.000%

Regards,

Reshma

Like John Funk likes this
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.
July 10, 2023

Smart values are name, spacing, and case-sensitive, so please try this to see if that is the cause of the error:

{{issue.Story points.asPercentage}}
Like John Funk likes this
Reshma Ulvekar August 3, 2023

Hi Bill,

Thank You for your help.

Unfortunately the functionality is not working as expected. now..

I have created three new fields. Story Points in Epic, Story Points Left in Epic, Percentage Completion. 

Story Pints in Epic will sum up all the story points when issue is transitioned form To to In Development State. 

Story Points Left in Epic will sum up all the story points when issue is transitioned from all  Development to Done state. 

Percentage Completion will , add Story Points in Epic and Story Points Left in Epic which will be dived by 100 and give percentage. 

Now the issue is when the Stories are created and assigned story points, when one story is transitioned from To to In Progress, then it also sum up the story pints which are not transitioned. 

Can you please help me if my above workflow has any issue ?

 

Regards,

Reshma.

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.
August 3, 2023

Would you please post images of:

  • the complete rule that does not work as you expect,
  • images of the actions where the math occurs, and
  • of the audit log details showing the rule execution? 

Those will provide context to help understand the symptoms you are observing.  Thanks!

Reshma Ulvekar August 4, 2023

Hi Bill,

Please find screenshot of the rule which is not working. 

Math expression : 

{{webhookResponse.body.issues.fields.customfield_XXXX.sum}}

Screenshot of rule not working..PNG

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.
August 4, 2023

When that web request, response comes back, I believe it is text and not typed, such as a numbers.

The work-around is to force this into a number using a math expression containing an iterator over the issues, perhaps like this:

{{#=}}0{{#webhookResponse.body.issues}}+{{customfield_XXXX}}{{/}}{{/}}

If that does not work, I recommend writing the response from that web request action to the audit log to confirm the structure matches what you expect.

Reshma Ulvekar August 9, 2023

HI Bill,

Many thanks for your support. 

I tried using above math expression but it gave me 0 in the log. 

Actually we used JMW where To Do state is traversed to Done state. 

When i tried getting logs of issue,status when issue is moved to Done from In development state it gave me To Do in the log. 

When we move to done state, we give resolution as Done. I tried to get resolution name using {{resolution.name}} still nothing seems working. Is there way to get resolution status?

Reagrds,

Reshma

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.
August 9, 2023

Please try writing {{webhookResponse.body}} to the audit log to confirm the structure matches what you expect.

If that works, then do the same with {{webhookResponse.body.issues.first}}

And, what is the type of the custom field you are trying to sum?

Reshma Ulvekar August 10, 2023

Hi Bill,

I tried using above expression, it gave first story in Jira which is marked as done. 

I want to sum up only story which are moved to done state. 

I am using number field custom filed to sum up story points value. 

Regards,

Reshma.

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.
August 12, 2023

Thanks, and now let's go further to confirm your custom field contains what you expect by writing these to the audit log.  Remember to update that with your specific custom field's id value.

The field is: {{webhookResponse.body.issues.first.customfield_12345}}

The field as a number is: {{webhookResponse.body.issues.first.customfield_12345.asNumber}}

Reshma Ulvekar September 7, 2023

Hi Bil,,

Hope your doing well.

I have added above syntax in LOg work and i see that story whihc atre in To DO as well getting calculated whne story is move dto Done state.

I am basiclaly uisnh below webhhok url in Sedn web request .

{{baseUrl}}/rest/agile/1.0/epic/{{issue.key}}/issue?maxResult=100

Wnated to know if there is api clal that can be made here to get all the iissues in epic whihc are in done state?

Regards,

Reshma Ulvekar

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.
September 7, 2023

Please try using the Log action, not the Log Work action.  The "Log action" will write a value to the rule's audit log, and that can be viewed after the rule runs.

You also asked: is there a way to get all issues in an epic in a done state?

One way to do that is with the issue search function with the REST API using JQL, such as with:

"Epic Link" = yourEpicKey AND statusCategory = Done

Reshma Ulvekar September 10, 2023

Hi Bill,

I have tried using Log action and i see that Story point filed which are in To Do state is considered as well when issue is transition to Done state. 

Can this be becuase of the way the wekbook url gets the response and edit the filed the which is having same custom filed in al the status?

Webhook URL : {{baseUrl}}/rest/agile/1.0/epic/{{issue.key}}/issue?maxResult=100

Edit issue  : {{webhookResponse.body.issues.fields.customfield_xxxx.sum}}

Also can you please help me how can we pass jql in the webhhokk url? I am unable to figure out the same. 

Regards,

Reshma.

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.
September 11, 2023

I think you have at least 2 options:

Use that same REST API function which gets all issues in the epic, and then use smart value, list filtering and math functions to add up the story points.  Please look here to learn about those ways: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588 and https://confluence.atlassian.com/automation/jira-smart-values-math-expressions-993924866.html

Or instead use the issue search REST API function, as that would allow using the JQL.  https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#searching-for-issues-examples 

Suggest an answer

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

Atlassian Community Events