Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rajeshqvd
Creator II
Creator II

Finding Cycles

Hi,

I need below req' in Qlik.

 

Thanks,

 

ID Data Output Output should be
222 AB Cycle1 Cycle1
222 AB Cycle2 Cycle2
222 AB Cycle3 Cycle3
222 e Cycle4 Cycle3
222 ffg Cycle4 Cycle3
222 aa Cycle4 Cycle3
222 ff Cycle4 Cycle3
222 df Cycle4 Cycle3

but in other scenario it coming correctly
ID Data Output
111 a Cycle1
111 b Cycle1
111 c Cycle1
111 d Cycle1
111 AB Cycle1
111 j Cycle2
111 k Cycle2
111 AB Cycle2
111 kl Cycle3
111 hg Cycle3
111 hgg Cycle3
111 AB Cycle3

Labels (1)
17 Replies
rajeshqvd
Creator II
Creator II
Author

Please change RowNum 13,14,15 'Data' value as 'AB' you can get to know

Thanks,
sunny_talwar

Why would it not increment to cycle4? Seems like the logic is always incrementing by 1 if there is AB on the previous row. This look like a special scenario and providing a fix for this might break other places...

rajeshqvd
Creator II
Creator II
Author

right i think you got my point..... is there any solution for this
sunny_talwar

There might be, but like I said it might break other places... what is so unique about this example which makes you into increment by 1 after AB on the previous row? what if the data was like this?

    222, AB
    222, AB
    222, AB
    222, AB
    222, e

or this

    222, AB
    222, AB
    222, AB
    222, AB
    222, AB

There are 1000 possibilities that could happen, how do we find the anomalies?

rajeshqvd
Creator II
Creator II
Author

Where ever AB that should be return Cycle count and below rows return above AB Cycle count

222, AB,1
222,AB,2
222,sd,2
222,eff,2
and
222,AB,1
222,mm,1
222,kj,1
222,AB,2
222,kkjj,2
222,km,2
sunny_talwar

So, then this is wrong?

image.png

Row 5 should be 2 then, right?

rajeshqvd
Creator II
Creator II
Author

No that is right try below data
ID,Data,Required Output
222,AB,1
222,AB,2
222,kkjj,2
222,km,2
222,ghg,2
sunny_talwar

I am not sure I follow. May be someone else might be able to help you here.