Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
mhassinger
Creator
Creator

Accumulation in a pivot table

Right now I have a pivot table that looks like this

                    Jan 2014                                             Feb 2014                                             Mar 2014

                    Total Users | Migrated | % Migrated   Total Users | Migrated | % Migrated    Total Users | Migrated | % Migrated

USA              
UK

Germany
France

So 2 dimensions (MonthYear and Country) and 3 expressions (Total Users, Migrated, and % Migrated)

Total Users = Sum(TotalUsers)

Migrated = Count({<MigrationStatus={'Migration Completed'}>}UserName)

% Migrated = Migrated / Total Users

What I need to be able to do is have the Migrated expression become cumulative, so that if if USA migrated 100 users in Jan and 200 in Feb, the value in Feb should be 300.

How would I go about re-writing the expression? Thanks!

7 Replies
sunny_talwar

I would try to do the cumulative count at the script level itself. I can be more helpful if you have a sample qvw file.

Best,

S

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can make your pivot table expressions cumulative by wrapping them in a rangesum(before()) function.

rangesum(before(Sum(TotalUsers),0,RowNo()))

-Rob

http://masterssummit.com

http://robwunderlich.com

jonasheisterkam
Partner - Creator III
Partner - Creator III

You can use Valuelist() to disconnect your dimension.

terezagr
Partner - Creator III
Partner - Creator III

Hi Michael,

I agree with Rob. Please see attached example.Capture.PNG

T.

mhassinger
Creator
Creator
Author

I'm attaching my own QV file to see if anyone can see what I'm doing wrong. If you look at the "Migrated" expression, you'll see that I'm trying to use the rangesum and before functions, but it isn't producing the expected result.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

My mistake. The rowno() won't always work properly as a counter. Use 999 instead as the row counter.

rangesum(before(Count({<MigrationStatus={'Migration Completed'}>}DisplayName),0,999))

Make 999 bigger if you have more date than that

-Rob

http://masterssummit.com

http://robwunderlich.com

mhassinger
Creator
Creator
Author

Thanks all for the help. I couldn't get the rangesum solution to work in the chart for some reason, so I just added a cumulative column to the script and used rangesum and peek to built it out there. Thanks again for all the suggestions!