Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

demoustier
Not applicable

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

1 Solution

Accepted Solutions
Not applicable

Re: Peek vs Previous

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

2 Replies
Not applicable

Re: Peek vs Previous

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
Not applicable

Re: Peek vs Previous

hey !

it seems good !!!!

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

Thanks !!!!!!