Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Polina
Contributor II
Contributor II

Using data from previous rows in the calculations

Dear community,

I have a problem and I hope that someone from the more experienced community members than I am can help me in solving it. I have something like rooster data looking similar to what you see below. For each rooster consisting of several time periods (marked with index numbers) I have begin and end time of the whole rooster and duration of each time period. From that I need to calculate begin and end time of each time period. For each id and date the indexes start from 1, so that for ID 569 it will again be 1,2,3,4 etc.

I was thinking of adding the sum of the duration of previous rows (indexes) to the begin time rooster for each particular id and date. So that in the below example the begin time for index 2 will be 09:00 + 15 = 09:15, and the begin time for index 3 will be 09:00 + 15 + 30 = 09:45. But I don't quite know how to realise it in the load statement of qlikview. I was thinking of using peek or previous functions but did not get very far. Thank you in advance for your help and advice.

indexidbegin time roosterend time roosterdateduration
156809:0011:3003-01-201915
256809:0011:3003-01-201930
356809:0011:3003-01-201915
456809:0011:3003-01-201975
556809:0011:3003-01-201915
1 Solution

Accepted Solutions
2 Replies
Saravanan_Desingh

Hi,

 

Search for accumulation in the script. 

 

One example:

https://community.qlik.com/t5/New-to-QlikView/Accumulation-in-Script/td-p/319965

Polina
Contributor II
Contributor II
Author

I only now had time to check this! Thank you for the helpful hint! It worked! I used functions Previous, RangeSum and Peek as mentioned in the link you have provided and it works the way I want it.