
Creator
2018-05-30
10:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Peek value of next row within a group
I have a table like this:
Date | Key |
---|---|
Date1 | A |
Date2 | B |
Date3 | A |
Date4 | A |
Date5 | B |
Date6 | B |
Date7 | B |
Date8 | A |
... | ... |
The result should look like:
Date | Key | Diff |
---|---|---|
Date1 | A | |
Date2 | B | |
Date3 | A | Date3-Date1 |
Date4 | A | Date4-Date3 |
Date5 | B | Date5-Date2 |
Date6 | B | Date6-Date5 |
Date7 | B | Date7-Date6 |
Date8 | A | Date8-Date4 |
... | ... | ... |
I can't solve the problem with peek, group by and sort by.
Can anyone help me here?
Thanks!
2,464 Views
1 Solution
Accepted Solutions

Creator
2018-05-30
11:18 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, I found the solution here: https://community.qlik.com/thread/180199
2,363 Views
2 Replies

Creator
2018-05-30
11:18 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, I found the solution here: https://community.qlik.com/thread/180199
2,364 Views

Anonymous
Not applicable
2018-05-30
11:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TEMP:
LOAD RecNo() as ##,* INLINE [
DATEFIELD, FIELD
Date1, A
Date2, B
Date3, A
Date4, A
Date5, B
Date6, B
Date7, B
Date8, A
];
TEMP2:
LOAD RecNo() as ##_2,
if(FIELD=Previous(FIELD),(DATEFIELD&'-'&Previous(DATEFIELD))) as NEWDATEFIELD,
* Resident TEMP
order by FIELD,DATEFIELD;
NoConcatenate
TABLE:
LOAD * Resident TEMP2
order by ##;
DROP Table TEMP,TEMP2;
DROP Field ##_2,DATEFIELD;
RENAME field NEWDATEFIELD to DATEFIELD;
2,363 Views
