Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
March 26 at 10am ET: See how Qlik drives growth and value in ISV segment - REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Keerthi1234
Contributor III
Contributor III

Cumulative Sum for specific Product

Hi All,

I need to calculate the cumulative sum with respect to each product .i.e the cumulative sum should restart for every product. I tried Solved: Cumulative Sum in QlikSense Expression using Range... - Qlik Community - 1691470 this solution, but it happens to give 0 in some of the values. 

Table includes Year,Product,Total Cost

For certain products it is working fine ,for others it is not ,why is this happening?

Has anyone faced this issue, Please help with your inputs

Labels (4)
1 Reply
eddyvargas
Contributor III
Contributor III

I prefer to make in the script

 

Fatotmp:
NoConcatenate
LOAD *
Resident Fato
Order by Product,Year,[Total Cost];

Drop Table Fato;

Final:
LOAD
Year,
Product,
[Total Cost],
If(Product = Previous(Product) ,RangeSum(Peek(Vl_Acumulado),[Total Cost]), [Total Cost]) as Vl_Acumulado
Resident Fatotmp
Order by Product,Year,[Total Cost]
;

Drop Table Fatotmp;