Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate data from previous rows in script

Hi to everyone!

I have a db table like:

32.png

Yellow cells is have to be calculated.

ToBuy = Ordered - Remain

Remain = Remain (in previous month) - Ordered (in previous month) + ToBuy (in previous month)

So, the result should be like:

31.png

Please, help to make it in load script or give please a hint to find the solution. Thanks!

P.S. I tried to make it in expression, but I couldn't do it in pivot table where I put in columns "Month-Year".

Thanks!

2 Replies
Not applicable
Author

I think the only way is to make Looping.

But I don't know how to make it in right way. Please help!

marcus_sommer

You could use previous() or peek() to catch the values from the previous records - a very good explanation could you find here: Peek() or Previous() ? and in your case, something like:

previous(Remain) - previous(Ordered) + previous(ToBuy)

- Marcus