How to sum the custom field value in all stories and display the total under the Epic

Hi,

I am using AUtomation for JIRA currently.

Is there a way where I can add the custom number field of all the stories under an Epic and display the total in an Epic custom  field?

 

Example:

Story 1 = 10

Story 2 = 15

Epic field should display 25

 

Thanks,

Sruthi

3 answers

0 vote

Hi Sruthi,

There are a couple Communities posts that have provided some guidance on this.  One suggestion I have seen is to use EazyBI and you can find a post regarding this add-on at EazyBI - calculate sum of custom field values for issues in Epic?

There is also another knowledge base article from Arsenal you may want to look at as well titled Rolling Up Epic Time Estimates.

Cheers,

Branden

Hi Branden,

 

Thank you for responding.

EazyBi is mostly for reporting.

 

I want the the numbers under 'Custom Field X' of all the stories to add up and display under the 'Custom Field X' in an Epic.

I see automation in JIRA add-on allows that. But not sure how to configure it for a custom field in JIRA.

Thanks,

Sruthi V

Hey Sruthi,

I answered your question on our internal support tracker, but I'll re-post the answer I had here.

In your case, you want to update the story points of three fields. To do this, you'll need to create three separate rules, one for each field. Each rule should look like the following photos show (and you can click 'Copy' on the main screen once you've created the first one to make this a lot easier):

 

Screen Shot 2017-12-15 at 10.41.49 am.pngScreen Shot 2017-12-15 at 10.41.56 am.pngScreen Shot 2017-12-15 at 10.42.02 am.pngScreen Shot 2017-12-15 at 10.42.07 am.pngScreen Shot 2017-12-15 at 10.42.12 am.pngIt's important to have the check for whether the Epic exists, or you'll run into some errors when the field is updated on a rule without an Epic.

Then in the box under 'Edit issue', you want to have the following text:

{{issue.Sum me up}}{{^issue.Sum me up}}0{{/}} - {{fieldChange.fromString}}{{^fieldChange.fromString}}0{{/}} + {{fieldChange.toString}}{{^fieldChange.toString}}0{{/}}

You should change the words 'Sum me up' to the name of whatever field you're changing at the time.

I hope this helps you and anyone else visiting these forums!

Huw

Hi Huw,

The above solution worked for any newly created Epics and stories.

 

But does not work for already existing Epic with stories & points

Initial Set

Story 1 =5

Story 2 = 5

So Epic = 0

Now i edit one of the Story to trigger the rule

Story 1 =10 

Story 2 = 5

So Epic = 5

It is only taking the point from the story that triggered the rule. Not going over the rest of the stories to calculate their points

Everytime the Story number field gets updated, then the rule should go over the stories and calculate the sum.

 

 

Thanks,

Sruthi

Hey @Sruthi Vijayakumar,

Looks like you're already using Automation. But if you're open to trying another add-on, I'd recommend using Power Scripts.

With a few lines of code you can very quickly sum the custom field values and display them in another field when viewing the Epic.

Here's a short video tutorial that walks through exactly how to setup this sort of algebra. You'd just need to modify the issue types, and change to addition instead of subtraction, for your needs.

And here's the sample code used, just for reference:

//This script grabs values from the expense field in the issues subtasks
//and then subtracts them from the budget
 
string [] stasks = subtasks(key);
int budget = customfield_10714;
 
if(isNotNull(budget)) {
    for(string s in stasks) {
        if(isNotNull(%s%.customfield_10713)) {
            budget = budget - s.customfield_10713;
        }
    }
}
 
return budget;

Hope this helps!

Thanks,

Johnson

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

170 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you