Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Try this
(vstock+RangeSum(Above(Sum({<Month>}Sellout)-Sum({<Month>}Sellin), 0, RowNo()))) * Avg(1)
Try this
(vstock+RangeSum(Above(Sum({<Month>}Sellout)-Sum({<Month>}Sellin), 0, RowNo()))) * Avg(1)
Thank you Sunny, That worked.
Awesome, please close the thread in that case.
Best,
Sunny