How do I sum up numerical values of multiple custom fields?

Dipen Patel December 2, 2014
 

2 answers

1 accepted

0 votes
Answer accepted
Danilo Conrad
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 11, 2014

Hi Dipen,

Another plugin which provides calculated custom fields is the JIRA Misc Custom Fields plugin.

For more details about how to configure such fields, you may refer to their documentation, linked below:

https://innovalog.atlassian.net/wiki/display/JMCF/JIRA+Misc+Custom+Fields

Cheers,

Danilo

Dipen Patel December 15, 2014

Hi Danilo, Thank you - this was very helpful. My only problem is that my custom fields that I am calculating are from a drop down list that contain both numeric and alpha-numeric values, so it is concatenating the values rather than adding them. Is there a way to 1) make them add, and 2) there is only one alphanumeric value and can i create a condition that makes the code looks at it as a numeric value of my choosing? Thanks, Dipen

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 15, 2014

Not with the JMCF - it requires numerics. You need the script-runner to be able to cast them correctly.

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 2, 2014

Find or write a addon that can add them up.  I'd use a calculated / scripted field provided by the script runner addon, but there are other options.

Dipen Patel December 4, 2014

Thank you! Do you have examples of how to sum the value of multiple fields?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2014

Depends on which plugin you use.

Dipen Patel December 10, 2014

Hi Nic, I am using the SumUp plugin, but i'm unsure how to configure it so that it adds up all the field values.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2014

Ah, the SumUp plugin is for adding up the values for one field on many issues, not accumulating fields. If you imagine your list of issues as a spreadsheet, one row per issue and one field per column, then SumUp provides "column totals". What you're looking for is "row totals"

Dipen Patel December 11, 2014

Thanks Nic, so what do you recommend I use to get "row totals"

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 11, 2014

I'd use the script runner...

Dipen Patel December 11, 2014

Thanks - As i'm new to the Jira, are you able to provide an example script that I can use. Here is what I have: Custom Field 1 = 5 Custom Field 2 = 5 Custom Field 3 = 5 Total Custom Field = 15 Looking how to script the Total Custom Field.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 11, 2014

Add a "scripted field" and have a look through https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+Fields

MAG-II August 28, 2019

Hi I am attempting to follow this thread to work through Scripted Fields via Scriptrunner.

In my project I have 3 number fields: "Amount Deposited", "Amount Spent," and "Amount Available" - Amount Available would be the Script Field.

All values for Amount Deposited are added to Amount Available. All values for Amount Spent are subtracted from Amount Available.

The Scripted Field, Amount Available, would account for all Issues/values of Amount Deposited and Amount Spent. I was hoping maybe an aggregateExpression could show this value in the Search for Issues page? At this point I am not seeing an aggregateExpression that adds and subtracts number field values.

Is such a Script Field possible?

Suggest an answer

Log in or Sign up to answer