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: 
Stefanie_W
Contributor
Contributor

Peek with multiple rows

Hi, 

I'm relatively new to Qlik and need some help.

I have data, that looks like this: 

PersNr Year Month Value
123000 2023 1 30
123000 2023 2 -
123000 2023 3 -
123000 2023 4 -
123000 2023 5 -
149999 2023 1 20
149999 2023 2 -
149999 2023 3 -
149999 2023 4

 

This is, what I need the data to look like: 

PersNr Year Month Value Value_ new
123000 2023 1 30 30
123000 2023 2   30
123000 2023 3   30
123000 2023 4   30
123000 2023 5   30
149999 2023 1 20 20
149999 2023 2   20
149999 2023 3   20
149999 2023 4   20

How can this be solved. My current script only shows data for the empty row after the row with the value, but not for all empty rows. 

if(isnull(Value),peek(Value),Value) as Value_new

 

Can you help me? 

 

Thanks in advance! 

Stefanie 

Labels (1)
1 Solution

Accepted Solutions
Arek92
Contributor III
Contributor III

Hi Stefanie,

Maybe you can try sth like this: 

Firstly let's test below expression:

If(IsNull(Value), Peek(Value_new), Value)) as Value_new

 

If above won't work let's try 2nd option:

 

If(PersNr = Peek(PersNr), Peek(Value_new), Value) as Value_new

 

 

If 2nd option still doesn't work then order your table by PersNr, Year and Month  and try again.

Hope this will help!

Arek

 

View solution in original post

2 Replies
Arek92
Contributor III
Contributor III

Hi Stefanie,

Maybe you can try sth like this: 

Firstly let's test below expression:

If(IsNull(Value), Peek(Value_new), Value)) as Value_new

 

If above won't work let's try 2nd option:

 

If(PersNr = Peek(PersNr), Peek(Value_new), Value) as Value_new

 

 

If 2nd option still doesn't work then order your table by PersNr, Year and Month  and try again.

Hope this will help!

Arek

 

Stefanie_W
Contributor
Contributor
Author

Hi Arek, 

thank you for your help!
Both solutions work perfectly! 

Best regards, Stefanie