Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
mszerema01
Contributor
Contributor

Problem with Peek() function - it returns inproper values

Hello everyone,

I have problem with Peek function. I try to create rank (OT_TOIL_RANK) for particular ID ordered by Day column .

LOAD
*,
if(Previous(Key_TOIL_baza) = Key_TOIL_baza, Peek(OT_TOIL_RANK) + 1, 1) as OT_TOIL_RANK
Resident table
order by Key_TOIL_baza, Day ASC;

For two Staff IDs function do not work - it do not assingn any number of rank, it just pass over those IDs:

qlik.PNG

 

Do you have idea why it's happening?

 

 

 

1 Solution

Accepted Solutions
marcus_malinow
Partner - Specialist III
Partner - Specialist III

You're missing some single quotes in your Peek, also set row number to retrieve previous row (-1)

I'd also be inclined to change the Previous to a Peek, but that's purely personal preference

if(Peek('Key_TOIL_baza', -1) = Key_TOIL_baza, Peek('OT_TOIL_RANK', -1) + 1, 1) as OT_TOIL_RANK

View solution in original post

2 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

You're missing some single quotes in your Peek, also set row number to retrieve previous row (-1)

I'd also be inclined to change the Previous to a Peek, but that's purely personal preference

if(Peek('Key_TOIL_baza', -1) = Key_TOIL_baza, Peek('OT_TOIL_RANK', -1) + 1, 1) as OT_TOIL_RANK

mszerema01
Contributor
Contributor
Author

Marcus thanks a lot !!