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: 
subash
Partner - Contributor II
Partner - Contributor II

Fill up null cell with previous value

Hi All,

I need to fill null cell with previously stored values with the help of month. in my table i have 3 columns Product, Month and cost so each product has 4 months respectively like apr, may, jun & july for A product and same for B,C,D and E product so what i want whichever cell has null value that should be filled with cost of previous month value.

the requirement is shown in output column.

Output.PNG

Labels (1)
1 Reply
jonathandienst
Partner - Champion III
Partner - Champion III

Something along the lines of:

LOAD Product, 
	Month
	If(Len(Cost) = 0 And Product = Previous(Product),
		Alt(Peek(Cost), 0), Cost) as Cost
Resident  .....
Order by Product, Month;

The ordering will work if loading from a qvd, or a resident load. This also assume that month is a proper month field (not a string) that can be sorted normally) 

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein