Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
alvinford
Contributor III
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
1 Solution

Accepted Solutions
sunny_talwar

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

View solution in original post

3 Replies
sunny_talwar

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
Contributor III
Contributor III
Author

Thank You Sunny ...

Cheers !!

Regards,

Alvin.

Amit_Kakkad_PD
Contributor II
Contributor II

That is an amazing answer @sunny_talwar . Genius! Thank you so much!