Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with cumulative summary

Hi all,

I need some help with the cumulative summary.

Here is the how the data is

DateCount
03/30/20135
03/31/20137
04/01/20132
04/02/20138

Here is how the end result should look like. MOST IMPORTANTLY in the running totals should be the same even if the sort order of dates is changed (It is a requirement)

With ascending sort:

DateCumulative
03/30/20135
03/31/201312
04/01/201314
04/02/201322

With descending sort:

DateCumulative
04/02/201322
04/01/201314
03/31/201312
03/30/20135

I have tried with the Range sum RangeSum(Above( Sum(Count)),0, RowNo(TOTAL))) but SWITCHED to the option of creating an aggregated resident table where I am calculating the regular count of transactions and then joining it to the data model.

I need help with acheving the cumulative sum in the script where the data is loaded in the above mentioned resident table format. I know how to do in SQL. I would do a self join of the data table (D1 & D2) with with a condition on date (D1.Date <= D2.Date).

Can someone help me with how to do a self join to achieve the cumulative functionality in QLikview? Thanks in advance.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

Load the dates and counts in a table then calculate the cumulative using the peek function:

Result:

load Date, Count, rangesum(Count,peek(Cumulative)) as Cumulative

resident SomeTable

order by Date;


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Gysbert for the response but it did not work. I would appreciate if you can correct where I am doing wrong in the sample QVW I attached.

Thanks

Sameer

Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand
Not applicable
Author

Gysbert - It worked like magic. Thanks a lot for your time.