Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
ISK
Contributor II
Contributor II

Replace Null with Repeating Values

Hello All,

I have created a table with this line of code:

NoConcatenate
Final2:
Load
BSPL_Inventory_Material_Number,
BSPL_Posting_Date_Monthname,
Aggr_Qty,
If(Len(Aggr_Qty)>0, Aggr_Qty,peek('Aggr_Qty')) as Aggr_Qty2

Resident Dates order by BSPL_Inventory_Material_Number,BSPL_Posting_Date_Monthname;
Drop Table Dates;

 

Here's the output:

ISK_0-1723104319172.png

For each Material there are all months from Dec 2010 till Aug 2024. Aggr_Qty is only present for those months where posting was done. Now I want to do such that between each posting value i.e Aggr_Qty, the previous value should be repeated till the next Non-null Value. For that I created Aggr_Qty2 (check the code above). For some reason it is working but the value is only repeating for only the next row in order and not all rows. How to solve this?

Labels (1)
  • SaaS

1 Reply
Kushal_Chawda

@ISK  try below

If(Len(Trim(Aggr_Qty))=0, peek('Aggr_Qty2'), Aggr_Qty) as Aggr_Qty2