
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
index | id | begin time rooster | end time rooster | date | duration |
1 | 568 | 09:00 | 11:30 | 03-01-2019 | 15 |
2 | 568 | 09:00 | 11:30 | 03-01-2019 | 30 |
3 | 568 | 09:00 | 11:30 | 03-01-2019 | 15 |
4 | 568 | 09:00 | 11:30 | 03-01-2019 | 75 |
5 | 568 | 09:00 | 11:30 | 03-01-2019 | 15 |
- Tags:
- qlikview_scripting
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Search for accumulation in the script.
One example:
https://community.qlik.com/t5/New-to-QlikView/Accumulation-in-Script/td-p/319965
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Search for accumulation in the script.
One example:
https://community.qlik.com/t5/New-to-QlikView/Accumulation-in-Script/td-p/319965

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
