Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
demoustier
Creator
Creator

Peek vs Previous

Hi,

Do anybody have an idea to solve this very simple problem:

I have loaded a table like this:

INV

PO

key

a

1

X

b

1

X

c

X

d

X

e

2

Y

f

Y

g3Z
hZ
i4W
jW
kW
l5T
I5T

For each value of 'key' I can have 0 to n value of INV and/or PO

I'd like to fill in missing value of PO with PO value having same key

result should be:

INV

PO

key

PO2

a

1

X

1

b

1

X

1

c

X

1

d

X

1

e

2

Y

2

f

Y

2
g3Z3
hZ3
i4W4
jW4
kW4
l5T5
I5T5

I tried with if(key=previous(key) and isnull(PO),previous(PO),PO) as PO2 but it works only for one line....

Any idea ?

Kind regards

Labels (1)
1 Solution

Accepted Solutions
Not applicable

Try like below:

IF( IsNull(PO) AND key=Previous(key) , Peek(PO2) , PO ) AS PO2

Previous -- Loaded from previous loaded table

Peek -- Loaded from current table

View solution in original post

2 Replies
Not applicable

Try like below:

IF( IsNull(PO) AND key=Previous(key) , Peek(PO2) , PO ) AS PO2

Previous -- Loaded from previous loaded table

Peek -- Loaded from current table

demoustier
Creator
Creator
Author

hey !

it seems good !!!!

it perfectly works with the example but not in my application ?! Anyway, i will work on this way

Thanks !!!!!!