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: 
a_kosarev
Contributor II
Contributor II

Fill missing values with previous non-null values

Hi everyone,

I have an excel table that looks like this: 

WarehouseEmployee
Warehouse №3212
 16
 18
 5
 11
Warehouse №1524
 5
 8
 23
 12
 14
 19
 15
Warehouse №1120
 13
 7
 25
Warehouse №3016
 13
 12
 3
 21
Warehouse №3313
 15
 14

 

What I want to do is fill the missing values in the warehouse column with the closest previous non_null value. 

 

I've tried the peek() and previous() function, but they don't seem to do the trick. 

 

What can I do about the problem? 

 

 

 

Labels (1)
1 Solution

Accepted Solutions
anushree1
Specialist II
Specialist II

Please try the below script, also attached the sample for your reference:

Temp:
LOAD
Warehouse,
Employee
FROM [lib://Web_Conn]
(html, utf8, embedded labels, table is @1);
NoConcatenate
Data:
Load
if(len(trim(Warehouse))>0,Warehouse,peek(Warehouse)) as Warehouse,

Employee
Resident Temp;

drop Table Temp;

View solution in original post

1 Reply
anushree1
Specialist II
Specialist II

Please try the below script, also attached the sample for your reference:

Temp:
LOAD
Warehouse,
Employee
FROM [lib://Web_Conn]
(html, utf8, embedded labels, table is @1);
NoConcatenate
Data:
Load
if(len(trim(Warehouse))>0,Warehouse,peek(Warehouse)) as Warehouse,

Employee
Resident Temp;

drop Table Temp;