Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare previous column

Hi,

Need help on how i can achieve this in Qlikview. VCHSEQ is the column that will only populate 1 or 2 base on the condition of the previous row. I have tried to use peek and for loop but no success so far. Please refer to the attachment for more details. Any help is appreciated!

  

RRNXVCH7VCHSEQThis Row RRN minus Previous Row RRN
66825410000010
66825510000011
66825610000011
66825710000011
66825810000011
66825910000011
66826010000011
66826110000011
66826210000011
66826310000011
66826410000011
66826510000011
66826610000011
66826710000011
11000011-668266
210000111
310000111
6682681000012668265
66826910000121
66827010000121
66827110000121
66827210000221
66827310000221
66827410000221
66827510000221
41000031-668271
510000311
610000311
6682761000032668270
66827710000321
66827810000321
66827910000321
66828010000321
1 Solution

Accepted Solutions
Gysbert_Wassenaar

LOAD

     RRN,

     XVCH7,

     Alt(If(RRN-Previous(RRN)<>1,

          If(Previous(XVCH7)<>XVCH7,1,2),Peek(VCHSEQ)),0) as VCHSEQ

FROM

         ....


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

LOAD

     RRN,

     XVCH7,

     Alt(If(RRN-Previous(RRN)<>1,

          If(Previous(XVCH7)<>XVCH7,1,2),Peek(VCHSEQ)),0) as VCHSEQ

FROM

         ....


talk is cheap, supply exceeds demand
Not applicable
Author

Work brilliantly for me. Thanks!