Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
charlotte_qvw
Partner - Creator
Partner - Creator

Peek function

Can anyone help me with this script? I can't work out why amount is copying down only once, but not to any subsequent rows. If amount is null at all I would like to have the previous non null amount for an id copied down, but with my script it's only copying down to the first null line. Here is the script. many thanks

t1:

LOAD * Inline [

id, amount

1, 100

1,

1,

1, 400

2, 500

2, ];

t2:

NoConcatenate LOAD

id,

if(previous(id)=id, peek('amount'), amount) as amount2,

amount

Resident t1 order by id asc;

DROP Table t1;

3 Replies
tresesco
MVP
MVP

try:

if(previous(id)=id, peek('amount2'), amount) as amount2

charlotte_qvw
Partner - Creator
Partner - Creator
Author

Thanks v much! after i wrote the question i just worked that out!

Not applicable

like tres qv try this

if(previous(id)=id, peek('amount2'), amount) as amount2