Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

alvinford
New Contributor III

How to fill the blanks with the previous Value

Hi All,

I have my data as below, need to fill the gaps using the previous value. Used the following formula

if(Len(Step)>0,Step,Peek(Step)) as Step2 but it is only filling the next row not all the rows. Request your help to achieve this.

Need to achieve this using script.

Please refer the attachment for data.

Thank You in Advance...

  

OutSoldB224395
PRCB224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
TransferB224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
B224395
CPCB224395
B224395
B224395
B224395
Tags (1)
1 Solution

Accepted Solutions

Re: How to fill the blanks with the previous Value

Try this:

If(Len(Step)>0,Step,Peek('Step2')) as Step2

Script for your sample:

Table:

LOAD Step,

     StepCode,

     Date,

     StepCount,

     If(Len(Step)>0,Step,Peek('Step2')) as Step2

FROM

[Example (3).xlsx]

(ooxml, embedded labels, table is Sheet2);


Capture.PNG

2 Replies

Re: How to fill the blanks with the previous Value

Try this:

If(Len(Step)>0,Step,Peek('Step2')) as Step2

Script for your sample:

Table:

LOAD Step,

     StepCode,

     Date,

     StepCount,

     If(Len(Step)>0,Step,Peek('Step2')) as Step2

FROM

[Example (3).xlsx]

(ooxml, embedded labels, table is Sheet2);


Capture.PNG

alvinford
New Contributor III

Re: How to fill the blanks with the previous Value

Thank You Sunny ...

Cheers !!

Regards,

Alvin.