Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 | |
g | 3 | Z |
h | Z | |
i | 4 | W |
j | W | |
k | W | |
l | 5 | T |
I | 5 | T |
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 | |
g | 3 | Z | 3 |
h | Z | 3 | |
i | 4 | W | 4 |
j | W | 4 | |
k | W | 4 | |
l | 5 | T | 5 |
I | 5 | T | 5 |
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
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
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
hey !
it seems good !!!!
it perfectly works with the example but not in my application ?! Anyway, i will work on this way
Thanks !!!!!!