Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Fill a field when empty with previous value

Hi

I have a table like this:

Field1,     Field2

1,               A

2,              

3,              

4,               B

5,              


So field2 is empty in rows 2,3 and 5.

I wish to get a field3 where if row in field2 is empty it takes the value before in field3, and if not it takes the value in field2, resulting this:

Field1,     Field2,     Field3

1,               A              A

2,                               A

3,                               A

4,               B              B

5,                               B


How can do it as easy as possible?


Thnaks

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like

LOAD Field1,

        If( Len(Trim(Field2)), Field2, Peek(Field3) ) as Field3

FROM YourTable;

View solution in original post

4 Replies
swuehl
MVP
MVP

Maybe like

LOAD Field1,

        If( Len(Trim(Field2)), Field2, Peek(Field3) ) as Field3

FROM YourTable;

View solution in original post

Chanty4u
MVP
MVP

hi,wiz.PNG

sunny_talwar

Try this:

Table:

LOAD Field1,

  Field2,

  If(Len(Trim(Field2)) > 0, Field2, Peek('Field3')) as Field3;

LOAD * Inline [

Field1,     Field2

1,               A

2,             

3,             

4,               B

5,             

];


Capture.PNG