Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
stabben23
Partner - Master
Partner - Master

Peek on first row in subset

Hi, I want to use first row in a subset of data as comparison.

This is how I have script right now:

if(peek(Key)= Key, DateComparison - peek(StartDateComparison,0),0) as Days

But peek(StartDateComparison,0) will always find First row in table, not first row in subset (Bold Row).

So what I want is that all dates should for all Key should be Compared with StartDateComparison

stabben23_0-1656319346024.png

 

Labels (1)
1 Solution

Accepted Solutions
MayilVahanan

Hi

Try like below

if(peek(Key)= Key, peek(StartDateComparison),StartDateComparison) as StartDateComparison

By using above script, we can able to see  "StartDateComparison" values in all rows. Then, u can simply sub those 2 fields to get the "days".

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

3 Replies
MayilVahanan

Hi

Try like below

if(peek(Key)= Key, peek(StartDateComparison),StartDateComparison) as StartDateComparison

By using above script, we can able to see  "StartDateComparison" values in all rows. Then, u can simply sub those 2 fields to get the "days".

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
stabben23
Partner - Master
Partner - Master
Author

Hi @MayilVahanan 

That´s a great input, I will test this in my script.

 

stabben23
Partner - Master
Partner - Master
Author

Brilliant @MayilVahanan this was exactly what I needed.

Thanks!