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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum Aggregation Problem

I have the first to columns below, and need a way to create the third column. The sum column is the percentage of scores divided by the total number of records. I need the third column to be the rank order of the score percentages. In other words, 100% of scores are 1 or higher, 97% are 2 or higher, and so on.

ScoreSum(If(X),1,0)Need
10.031.00
20.020.97
30.050.95
40.060.90
50.070.84
60.100.77
70.090.66
80.080.58
90.090.50
100.070.41
110.040.34
120.050.31
130.060.26
140.090.19
150.060.11
160.030.05
170.010.02
180.010.01
190.000.00
200.000.00
210.000.00
1 Solution

Accepted Solutions
swuehl
MVP
MVP

Not sure how you get the second column, it would be good to get some input data as well, or even better, post a small sample app.

In general, you can get a cumulative sum of your second column using rangesum(above( EXPRESSION,0,rowno() )),

so try something like

=1.00 - rangesum(above( YOURSECONDCOLUMNEXPRESSION ,0,rowno()) )

edit: if you want to exclude the current dimension line from your aggregation, use an offset of 1:

=1.00 - rangesum(above( YOURSECONDCOLUMNEXPRESSION , 1,rowno()) )

View solution in original post

2 Replies
swuehl
MVP
MVP

Not sure how you get the second column, it would be good to get some input data as well, or even better, post a small sample app.

In general, you can get a cumulative sum of your second column using rangesum(above( EXPRESSION,0,rowno() )),

so try something like

=1.00 - rangesum(above( YOURSECONDCOLUMNEXPRESSION ,0,rowno()) )

edit: if you want to exclude the current dimension line from your aggregation, use an offset of 1:

=1.00 - rangesum(above( YOURSECONDCOLUMNEXPRESSION , 1,rowno()) )

Not applicable
Author

Thank you very much. That is exactly what i needed.