cancel
Showing results for
Did you mean:
Contributor III

## How to calculate cumulative sum without impacting sorting order?

Hi,  I have a table, with dimension = Scrap Code, measure= Qty(number of scrap code) I want to calculate accum coloumn & order table with Qty descending so as to get the top  scarp codes, and cumulative sum should not impact the order. Expected output-

 Scrap Code Qty Accum 4P 8 8 4W 7 15 4H 5 20 1I 4 24 1B 2 26

Labels (1)
• ### cumulativesum in Qliksense

2 Solutions

Accepted Solutions
Partner - Master

Hi Guddu,

Try this:

``RangeSum(Above(TOTAL Sum(Qty), 0, RowNo(TOTAL)))``

Jordy

Climber

Work smarter, not harder
Contributor III
Author

Thanks Jordy...
Using your formula and one addition thing I discovered just now it worked for me.

So, if using range & above() function , sorting needs to be done by expression in the sorting tab under dimensions name.

7 Replies
Partner - Master

Hi Guddu,

Try this:

``RangeSum(Above(TOTAL Sum(Qty), 0, RowNo(TOTAL)))``

Jordy

Climber

Work smarter, not harder
Contributor III
Author

I tried these but when I am using rangesum()/above() function by Qty Column is no longer sorted DESC.
I want to keep Qty column DESC always

Partner - Master

That shouldn't be a problem. If you go to settings -> Sorting. Is Qty then at top? If not, put this on top.

Jordy

Climber

Work smarter, not harder
Contributor III
Author

Tried that already, didn't work as above funtion doesn't work with built in sorting.

Partner - Master

I don't know why it shouldn't work, because if I use your example, it works:

Jordy

Climber

Work smarter, not harder
Contributor III
Author

Thanks Jordy...
Using your formula and one addition thing I discovered just now it worked for me.

So, if using range & above() function , sorting needs to be done by expression in the sorting tab under dimensions name.

Partner - Contributor III

Hi Jordy,