Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
RichardLee
Creator
Creator

Calculate Closing Balance

Hi if someone could help me it will be great.

 

I have a table with

 

DATE | AMOUNT | CODE |

how can I create a closing Balance for each of the codes ?

 

DATE AMOUNT CODE
30/11/2005 -97.98 2100
30/11/2005 -81.65 7306
30/11/2005 -16.33 2201
30/11/2005 16.33 2201
30/11/2005 81.65 7306
30/11/2005 97.98 2100
01/01/2009 -294.8 2100
01/01/2009 38.45 2201
01/01/2009 256.35 5000
14/01/2009 -543.86 4000
14/01/2009 -81.58 2200
14/01/2009 625.44 1100
16/01/2009 -97.89 4000
16/01/2009 -14.69 2200
16/01/2009 112.58 1100
19/01/2009 -7091.3 4000
19/01/2009 -1371.74 4000
19/01/2009 -1063.7 2200
19/01/2009 -928.77 4000
Labels (2)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master
Partner - Master

This is a front-end approach

Sum(Aggr(Sum(AMOUNT),CODE))

peter_brown_0-1661935212257.png

 

View solution in original post

4 Replies
deepanshuSh
Creator III
Creator III

Hi  Richard, The above requirement seems to be confounding. Could you showcase the data and what exactly you are looking for like before and after?

Trial and error is the key to get unexpected results.
RichardLee
Creator
Creator
Author

I've added a block of the data.

DATE AMOUNT CODE
30/11/2005 -97.98 2100
30/11/2005 -81.65 7306
30/11/2005 -16.33 2201
30/11/2005 16.33 2201
30/11/2005 81.65 7306
30/11/2005 97.98 2100
01/01/2009 -294.8 2100
01/01/2009 38.45 2201
01/01/2009 256.35 5000
14/01/2009 -543.86 4000
14/01/2009 -81.58 2200
14/01/2009 625.44 1100
16/01/2009 -97.89 4000
16/01/2009 -14.69 2200
16/01/2009 112.58 1100
19/01/2009 -7091.3 4000
19/01/2009 -1371.74 4000
19/01/2009 -1063.7 2200
19/01/2009 -928.77 4000

 

I just need to know how to calculate the closing balance for each code even if that means I need to put the opening balance that would be even better.

BrunPierre
Partner - Master
Partner - Master

This is a front-end approach

Sum(Aggr(Sum(AMOUNT),CODE))

peter_brown_0-1661935212257.png

 

RichardLee
Creator
Creator
Author

Thanks for this Peter.