Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to flag the rows where peek(counter)<counter but the last column is what qlik does instead.
This load is reading a resident table. not sure if that makes a difference\
Thanks
This returns your desired results:
Data: LOAD * INLINE [ rownum, Counter 1, 0 2, 1 3, 2 4, 3 5, 1 6, 2 7, 0 ]; Test: LOAD rownum, Counter, IF(PEEK(Counter) < Counter, 1, 0) as peek RESIDENT Data ORDER BY rownum DESC, Counter DESC; DROP TABLE Data;
Data:
LOAD * INLINE [
rownum, Counter
1, 0
2, 1
3, 2
4, 3
5, 1
6, 2
7, 0
];
Test:
LOAD rownum, Counter, IF(PEEK(Counter) < Counter, 1, 0) as peek
RESIDENT Data
ORDER BY rownum DESC, Counter DESC;
DROP TABLE Data;
I've also attached an example file.