Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rulohx87
Contributor III
Contributor III

Fill empty values ​​with previous rows

Hello everyone !

I try to fill a name with a previous name where the values are nulls. I Tried with the function Previous():

IF(isNull(Name),Previous(Name),Name) // It's ok, but return one value.

Table:

idName
1Danna
2Issac
3 
4 
5John
6 

And I need these values.

idName
1Danna
2Issac
3Issac
4Issac
5John
6John

 

Thanks,

Labels (4)
1 Solution

Accepted Solutions
trdandamudi
Master II
Master II

One way of doing this is as below:

Data:
Load
id,
If(Len(Name)>0,Name,Peek(Name)) as Name;
Load * Inline [
id, Name
1, Danna
2, Issac
3,
4,
5, John
6,
]
;

Hope this helps.

View solution in original post

2 Replies
trdandamudi
Master II
Master II

One way of doing this is as below:

Data:
Load
id,
If(Len(Name)>0,Name,Peek(Name)) as Name;
Load * Inline [
id, Name
1, Danna
2, Issac
3,
4,
5, John
6,
]
;

Hope this helps.

koilpni
Contributor
Contributor

Previous cannot  work  for a row that has not been already loaded or present in internal.