Calculating Jira Data in Confluence
Asked by Lisa Tritt:

Hello community!

I am severely math challenged and have a large hole in my skull from banging it against the wall. Is there a way to take data from Jira and calculate it for display in Confluence?

Scenario: Take the last 7 days ticket Resolved - ticket Created = TAT and then add all tickets from the last 7 days and divide by number of tickets the average.

Thank you very much


Answers:
author: Katerina Kovriga {Stiltsoft}
body: Hi [@Lisa Tritt](/t5/user/viewprofilepage/user-id/1601459) ,

You need to use additional apps to use math formulas in Confluence.

For example, the [Table Filter and Charts for Confluence](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=cloud&tab=overview) app.

The first step is to insert the [Table Toolbox](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Toolbox+macro) macro on the page and paste the two Jira Issues macro inside its body ("wrap" your Jira Issues macros in the Table Toolbox macro).

Use the following JQL for the Jira Issues macros:

* project = project_name and created \>= -7d
* project = project_name and updated \>= -7d

Then your issue sets will be always up-to-date.

The second step is to go to the Table Toolbox macro and calculate the required numbers with the help of the [Pivot](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Pivot+Table+macro) and [Table Transformer](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Transformer+macro) macros.

![Fri 3-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/122802i285E8731F4991C43/image-size/large?v=v2&px=999 "Fri 3-1.png")![Fri 3-2.png](https://community.atlassian.com/t5/image/serverpage/image-id/122803iFDE377F3223F2961/image-size/large?v=v2&px=999 "Fri 3-2.png")![Fri 3-2-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/122805iA12F6E58BC8F4197/image-size/large?v=v2&px=999 "Fri 3-2-1.png")SELECT "Number" as 'Jira Issues', T1.'Count' as 'Created for the past 7 days' FROM T\*

Here we got the total number of the Created for the past 7 days issues and set an additional column for further purposes.

![Fri 3-3.png](https://community.atlassian.com/t5/image/serverpage/image-id/122807iB0F30B717EFB2245/image-size/large?v=v2&px=999 "Fri 3-3.png")![Fri 3-4.png](https://community.atlassian.com/t5/image/serverpage/image-id/122808i96B4D9495F3E3FF1/image-size/large?v=v2&px=999 "Fri 3-4.png")![Fri 3-4-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/122809i1345DA51B6326B2E/image-size/large?v=v2&px=999 "Fri 3-4-1.png")SELECT "Number" as 'Jira Issues', (T1.'Count Done'+T1.'Count Fixed') as 'Resolved for the past 7 days' FROM T\*

Here we got the number of the Resolved for the past 7 days issues, in our example this total number consists of the Done and Fixed issues.

![Fri 3-5.png](https://community.atlassian.com/t5/image/serverpage/image-id/122811iE17A73904CB6C1B1/image-size/large?v=v2&px=999 "Fri 3-5.png")![Fri 3-6.png](https://community.atlassian.com/t5/image/serverpage/image-id/122812i2FD10B2F7CE5DEFA/image-size/large?v=v2&px=999 "Fri 3-6.png")SELECT \*, (T1.'Created for the past 7 days'-T2.'Resolved for the past 7 days')/5 AS 'New counted value'  
FROM T1 OUTER JOIN T\* ON T1.'Jira Issues' = T\*.'Jira Issues'

Here we merge the two tables and use our final formula to show the New counted value (one value minus another and divided onto some average value).

The formulas are used just to show an example of calculations in Confluence tables. You may use any math sequences as you need for the case.

comments: author: Lisa Tritt
body: This is amazing, than you so much.


author: Katerina Kovriga {Stiltsoft}
body: I've just noticed that the number of the fixed issues for the Resolved for the past 7 days issues is fewer than for the created - don't pay attention on this. It's our test demo project, so I've used other JQLs for my Jira macros (not the 7 days ago, but weeks for the created issues) to get more or less corresponding numbers for the example.


author: Katerina Kovriga {Stiltsoft}
body: And here you'll find more examples of calculations and visualisations using the Jira Issues macro [https://docs.stiltsoft.com/display/public/TFAC/Using+Table+Filter+and+Charts+in+Combination+with+the+Jira+Issues+Macro](https://docs.stiltsoft.com/display/public/TFAC/Using+Table+Filter+and+Charts+in+Combination+with+the+Jira+Issues+Macro?)

You may just follow these examples step by step, the only difference will be in nesting of the macros through the Table Toolbox macro as I've shown on the screenshots above (the new Cloud editor doesn't support nesting anymore).


author: Lisa Tritt
body: Ok great. Thank you very much. I'll be testing this for sure.


author: Debra Jones
body: [@Katerina Kovriga {Stiltsoft}](/t5/user/viewprofilepage/user-id/1464746) That page link no longer works. Do you have another link for it?

Many thanks


author: Katerina Kovriga {Stiltsoft}
body: Hi [@Debra Jones](/t5/user/viewprofilepage/user-id/3931205) , the [link](https://docs.stiltsoft.com/display/public/TFAC/Using+Table+Filter+and+Charts+in+Combination+with+the+Jira+Issues+Macro) is the same - somehow it doesn't redirect if you click on it, but works perfectly well if to copy it and paste into the browser address page.


Tags: cloud

confluence-cloud