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: 
annick
Contributor III
Contributor III

Cumulative sums thru RangeSum sorted

Hello

From the following load script:

sales:
LOAD
* Inline [
Id, NbSales
0, 1
1, 2
2, 3
3, 4
];

I need to compute the cumulative sums starting from the highest Id value to the lowest Id value, as follows:

  • Id 3: 4
  • Id 2 : 7  (i.e. 4+3)
  • Id 1: 9 (i.e. 4+3+2)
  • Id 0: 10 (i.e. 4+3+2+1)

To achieve this, I used the following expression in the visualization:

  • Rangesum(Above(Sum(NbSales),0, RowNo(TOTAL)))
  • Sorting by Id in descending order

However I would like to display these cumulative sums in a different order i.e. from the lowest Id to the highest Id as follows:

  • Id 0: 10 (i.e. 4+3+2+1)
  • Id 1: 9 (i.e. 4+3+2)
  • d 2 : 7  (i.e. 4+3)
  • Id 3: 4

 

Would you know how to achieve this?

Many thanks

Kind regards

 

 

Labels (2)
1 Solution

Accepted Solutions
udit_k
Partner - Creator II
Partner - Creator II

USe Below Expression:-

Rangesum(below(Sum(NbSales),0,count(total Id)))

 

udit_k_0-1688465972209.png

 

View solution in original post

1 Reply
udit_k
Partner - Creator II
Partner - Creator II

USe Below Expression:-

Rangesum(below(Sum(NbSales),0,count(total Id)))

 

udit_k_0-1688465972209.png