The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Query to calculate the delta between two values and tally the total of the column

Veronica Brooker
November 17, 2021

Hi everyone, 

I have a table 9 column table in Confluence. Two of the columns are numeric with a total sum applied. 

The use case is:
Column A: Service Credits - values are debits. 
Column B: Total Service Credits Accrued - values are credits.  
With each new entry into column A, I need to subtract that value from the running total in  column B.
Both columns should also have a total sum of at the footer of the table. 

I have applied a Table Transformer, but I do not know the SQL query to do product this outcome. Can someone please share this with me or tell me if there is another Macro/way to accomplish this? 

Confluence Table Transformer - SQL Query.png

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Katerina Kovriga _Stiltsoft_
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 Champions.
November 18, 2021

Hi @Veronica Brooker ,

Please follow these steps: wrap your table into the Table Toolbox macro.

Thu 1-1.png

Then go to the macro settings and wrap your table subsequently into the Table Transformer and into the Table Filter macro.

Then go to to the Table Transformer macro and use the following SQL query:

Thu 1-2.png

SELECT *, ('Total Service Credits Accrued' + 'Service Credits') AS 'New Column' FROM T*

Go to the Settings tab and set the corresponding Date format:

Thu 1-3.png

Then go to the Table Filter macro settings and select the columns where you want to count the totals:

Thu 1-4.png

Hope this may help your case.

P.S. Here you can find more examples how to use the Table Transformer macro - use cases, source tables and SQL queries.

TAGS
AUG Leaders

Atlassian Community Events