Scriptrunner Scripted Field - Sum of CustomFields within a Project
Asked by Luca Kainzner:

Hey all,

Wish you a good day.

I'm trying to calculate the sum of all custom fields within a project.

Example:

I have a custom field: Beantrage F?rdersumme ?

I want to sum up all "numbers" in all customfields of every issue inside a single project (project name "IDIM").

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/345941i4787548722383CB7/image-size/large?v=v2&px=999 "image.png")

I have looked over the ScriptRunner library and various Snippets, but I'm still not getting the expected result.

Thanks in Advance

Luca


Answers:
author: Mehmet A _Bloompeak_
body: Hi [@Luca Kainzner](/t5/user/viewprofilepage/user-id/5482301)

Welcome to the Atlassian Community!

If you prefer using a marketplace app, you can try [Sum Up Reports for Jira](https://marketplace.atlassian.com/1231321) app developed by our team. This app provides various table reports based on the fields you choose.

* You can list the issue fields you want and sum up the values at the bottom.
* You can group your data on any field (sprint, status, assignee, component, project etc.) and sum up the field values (story points, time estimate etc.) or take averages.
* You can add this app as a gadget to your Jira dashboards.

Here is our [live demo dashboard](https://sumup-pro.bloompeak.io/demo) where you can see and modify any sample report and play with it.

For further details, you can have a look at [Sum Up and Average Reports in Jira Dashboards](https://community.atlassian.com/t5/App-Central/Sum-Up-and-Average-Reports-in-Jira-Dashboards/ba-p/2596950) article.

If you have any questions, feel free to [schedule a demo](https://bloompeak.io/schedule-a-call) with us.

Hope it helps.

comments: author: Luca Kainzner
body: Thanks, unfortunately we use DataCenter and this App is just available in the cloud.


author: Marc - Devoteam
body: Hi [@Luca Kainzner](/t5/user/viewprofilepage/user-id/5482301)

Welcome to the community.

You should also be bel to do this via an automation rule.

You can use smart values to make the calculation.

See documentation here: <https://confluence.atlassian.com/automation/jira-smart-values-math-expressions-993924866.html>


author: Ram Kumar Aravindakshan _Adaptavist_
body: Hi [@Luca Kainzner](/t5/user/viewprofilepage/user-id/5482301)

In your description, you mentioned:-
> I want to sum up all "numbers" in all customfields of every issue inside a single project (project name "IDIM").

From your description, it appears you want to calculate values from multiple custom fields and sum up the total in a Scripted Field. Is this correct?

If yes, then I have already provided a similar solution in this [Community Post](https://community.atlassian.com/t5/Jira-questions/Need-a-script-to-calculate-the-sum-of-a-custom-field-with-the/qaq-p/1983996). Please note that the solution provided may not be 100% exact to your requirements. Hence, you must modify the code accordingly.

It would be helpful if you could provide a screenshot of the fields you intend to include in the calculation, and I could try to provide a sample code.

I am looking forward to your feedback and clarification.

Thank you and Kind regards,  
Ram

comments: author: Luca Kainzner
body: Hello Ram :)

Hope your doing good :) Wish you a nice day.

Actually i saw this post, but I didn't got it to implementate correctly.

The actual **use case** is to sum up all fields ("Beantrage F?rdersumme ?" ; customfield_24704) within a project "IDFM" and to visualize it within a dashboard or similar - I thought the easiest way would be just another field where sum of alle these fields is visible. ("Summe Beantragter F?rdersummen ?" ; customfield_25201)

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/346316i75DA1D0D8516D60C/image-size/large?v=v2&px=999 "image.png")

Cheers Luca


author: Ram Kumar Aravindakshan _Adaptavist_
body: Hi [@Luca Kainzner](/t5/user/viewprofilepage/user-id/5482301)

Thank you for getting back and providing the requested information.

Just another doubt to clarify: are the values in the Number fields set with Decimal points or with normal Integer type numbers?

Also what Locale format are you using for the Numbers? Is it French?

I am looking forward to your feedback and clarification.

Thank you and Kind regards,  
Ram


author: Luca Kainzner
body: Hey Ram,

I got news - we have a different use case at all. The sum of the customfields fields (linked to epic's) should be shown in advanced roadmaps

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/347527i28751E32EF980F57/image-size/large?v=v2&px=999 "image.png")

I guess I have to open a new question


Tags: customfields

data-center

jira-data-center

scriptrunner

sum