Skip to main content
Announcements
Jan 15, Trends 2025! Get expert guidance to thrive post-AI with After AI: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
RanOuerg
Creator
Creator

Cumulative Sum on the previous commun Columns

Hello,

i need help to solve this issue , i've tested many codes but still not working on QlikView scripting, I have a data base with Country, Material , Qty

I need to calculate the cumulative Qty for all the previous rows if the key(Country, Material) is equal to the previous one than i do the sum like the example marked in Yellow here bellow row by row.

RaniaMH_0-1646300471197.png

i used Peek but it doesn't work well for my case

Is there any solution to apply this rules in the chart area?

Thank you in advance!

 

Labels (2)
3 Replies
hic
Former Employee
Former Employee

In the Load script you can do a 

If(Country=Peek(Country) and Material=Peek(Material), RangeSum(Qty,Peek(CumulativeQty)), Qty) as CumulativeQty,

Just make sure that you have ordered the rows with an "Order By".

In a chart, you can do something similar using Above() instead of Peek().  

RanOuerg
Creator
Creator
Author

Hello,

Yes with the order by it work very well, Thank you!

RanOuerg
Creator
Creator
Author

Hello Henric,

I applied the formula but now while doing the test i have duplicated lines whenever i added the CumulativeQty

and i can't use Distinct since i already search recurrences can you help with that ?