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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Fill with previous

If anyone is interested in an example of "fill with previous" - I posted it on Share QlikViews.

2 Replies
johnw
Champion III
Champion III

I suspect that the below will execute a little faster (fieldvalue() vs. distinct, fewer joins) and use less memory (temp field vs. temp table). I also have a feeling that there's a single-step solution, but I haven't come up with anything that works.

RIGHT JOIN (data)
LOAD
fieldvalue('Product',iterno()) as Product
,recno() as Month
AUTOGENERATE 12
WHILE len(fieldvalue('Product',iterno()))
;
LEFT JOIN (data)
LOAD
Product
,Month
,if(len(Qty)=0 and Product=peek(Product),peek(Qty2),Qty) as Qty2
RESIDENT data
ORDER BY Product,Month
;
DROP FIELD Qty;
RENAME FIELD Qty2 TO Qty;

Anonymous
Not applicable
Author

Thanks for the comment John. The fieldvalue() idea looks interesting.