Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

straight table cumulative sum

I want to do a cumulative sum with previous row data

I have 2 columns Sellout and Sellin and a Stock fixed at some value, here i took as 5.

since for the first row it has to take the stock value

I need to calculate inventory Projection(InvProj) as Previous Row value of Inventory Projection(InvProj)+Sellout-Sellin

Note Sellin and Sellout are from current row.

I have done the below, but when i select month it is taking it as the first row and expression is giving correct numers

Date

      Sellout

       Sellin

      InvProj

Starting Inv

5

Jan

12

22

15

Feb

3

2

14

Mar

4

5

15

Apr

55

43

3

May

33

25

-5

Jun

23

20

-8

Jul

22

2

-28

Aug

11

8

-31

I used the below calculation,

if(Rowno()=1,vstock+sum(Sellout)-sum(Sellin),rangesum(above(InvProj)+sum(Sellout)-sum(Sellin),0))

Please let me know where i went wrong..Please find the attached qlikview document.

Thanks,

Shravan

1 Solution

Accepted Solutions
sunny_talwar

Try this

(vstock+RangeSum(Above(Sum({<Month>}Sellout)-Sum({<Month>}Sellin), 0, RowNo()))) * Avg(1)

View solution in original post

3 Replies
sunny_talwar

Try this

(vstock+RangeSum(Above(Sum({<Month>}Sellout)-Sum({<Month>}Sellin), 0, RowNo()))) * Avg(1)

Anonymous
Not applicable
Author

Thank you Sunny, That worked.

sunny_talwar

Awesome, please close the thread in that case.

Best,

Sunny