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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
robin_heijt
Creator
Creator

Fill null columns with previous value

Hi All,

 

I have tried many different peek and previous functions, but I cannot seem to get it working in my script.

My data model is as followed:

ID               Date
2                   20/01/2019
2
2
2
2
4                   
4
4                  10/02/2018
4
4

How do I populate all blank fields with the same date as that of the 1st ID line?

3 Replies
sunny_talwar

First two rows for ID = 4 are null... do they stay null or do they all get Date carried over?

robin_heijt
Creator
Creator
Author

As long as the ID is the same, each null row should get the value that is present in one of the ID rows.
robin_heijt
Creator
Creator
Author

I tried using the following:

NoConcatenate
Load
    "Req. Identifier",
    if(len(Trim([New Offer Accepted Date]))=0,Peek("New Offer Accepted Date"),"New Offer Accepted Date") as "New Offer Accepted Date"

Resident OM
order by "Req. Identifier";
Drop Table OM;

Which gives me a partial result; Some lines are now filled with the previous info and are correct. But there are also a few lines that are getting non existing dates (The time stamp is not present in the source file).

Then I also tried using this:

NoConcatenate
Load
    "Req. Identifier",
    if(Previous("Req. Identifier")="Req. Identifier" and len(Trim([New Offer Accepted Date]))=0,Peek("New Offer Accepted Date"),"New Offer Accepted Date") as "New Offer Accepted Date"

Resident OM
order by "Req. Identifier";
Drop Table OM;

But this gives again in some lines the correct information, but in some other lines it deletes the New offer accepted date all together.