Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
Hi Arek,
thank you for your help!
Both solutions work perfectly!
Best regards, Stefanie