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: 
Not applicable

Running Total Calculation

I need to calculate a running total in my script.  My data set looks like the first 3 columns of this table:

LocationDateRevenueRunning Total
AJan-13 $  1,000 $ 1,000
AFeb-13 $   1,100 $ 2,100
AMar-13 $   1,200 $ 3,300
AApr-13 $   1,300 $ 4,600
BJan-13 $   1,400 $ 1,400
BFeb-13 $   1,500 $ 2,900
BMar-13 $   1,600 $ 4,500
BApr-13 $   1,700 $ 6,200
CJan-13 $   1,800 $ 1,800
CFeb-13 $   1,900 $ 3,700
CMar-13 $  2,000 $ 5,700
CApr-13 $   2,100 $ 7,800

I want to calculate the fourth column - a running total of Revenue grouped by column 'Location'. Any ideas ?  I'm going to be using this in a pivot table on the front end.

13 Replies
Not applicable
Author

Worked like a charm, thanks !

Anonymous
Not applicable
Author

Hi Marco:

I am a beginner and using the QV Personal Edition for now.  I cannot view your .qvw and while I have put your suggestion into my Straight Table expression as per the following, I am not quite getting the results you have shown.  Also the format that you have achieved with your approach is something I would like to get.  I refer here to the date sequence as well as to the suppression of duplicates in the Inv#.   I must be missing something somewhere.  If you would be good enough to elaborate on your strategy it would be most appreciatedRunningTotalsCalc.png

And thanks.  It is very satisfying to see how the QlikView Community responds.

David

MarcoWedel

Hi David,

hope these screenshots and this script might help you recreate the solution:

tab1:

LOAD Inv#,

    TransDate,

    TransType,

    TransAmt

FROM

[http://community.qlik.com/servlet/JiveServlet/download/546863-110747/QlikCommunity_Thread_121052.xls...]

(ooxml, embedded labels, table is Tabelle1);

QlikCommunity_Thread_121052_Pic1.JPG.jpg

pivot table !

QlikCommunity_Thread_121052_Pic2.JPG.jpg

QlikCommunity_Thread_121052_Pic3.JPG.jpg

QlikCommunity_Thread_121052_Pic4.JPG.jpg

regards

Marco

Anonymous
Not applicable
Author

Hi Marco

And thank you.  I was just missing the sum(TransAmt) for the 2nd Expression.  Works fine now and really helped a lot.

Regards

David