Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Filling missing values with previous values > Several rows per date

Hello,

could someone help me with an optimization :-)?


Starting Situation:

I have to fill the two fields "Waehrung" and "Kurs" with the previous day, which contains values.

Goal >

Before:

After:

My Problem >

With the different approaches, which I had tried, I always come only on one row (max oder min value but not all rows).

How I can get all rows? The number of the rows is always different.


// ---------------------------------------------------------------------------------------------------------------


By this way, what I have find here in the community, I get just the min row:


NoConcatenate

WaehrungTmp3:

LOAD Dat_Gueltig_AbTMP,

     Waehrung,

     Kurs,

     Ursprung

Resident WaehrungTmp2;

Drop Table WaehrungTmp2;

Join (WaehrungTmp3)

LOAD Date(Min + IterNo() - 1) as Dat_Gueltig_AbTMP

    While Min + IterNo() - 1 < Max;

LOAD Max(Dat_Gueltig_AbTMP) as Max,

     Min(Dat_Gueltig_AbTMP) as Min

Resident WaehrungTmp3;

// -------------------------------------------------------

NoConcatenate

WaehrungTmp4:

LOAD Dat_Gueltig_AbTMP,

     If(Len(Trim(Waehrung)) = 0, Peek('Waehrung'), Waehrung) as Waehrung,

     If(Len(Trim(Kurs)) = 0, Peek('Kurs'), Kurs) as Kurs,

     Ursprung

Resident WaehrungTmp3

Order by Dat_Gueltig_AbTMP;

Drop Table WaehrungTmp3;

NoConcatenate

WaehrungTmp5:

LOAD Dat_Gueltig_AbTMP,

     year(Dat_Gueltig_AbTMP) as Dat_Gueltig_Ab_JahrTMP,

     month (Dat_Gueltig_AbTMP) as Dat_Gueltig_Ab_MonatTMP,

     day(Dat_Gueltig_AbTMP) as Dat_Gueltig_Ab_TagTMP,

     Waehrung,

     Kurs,

     Ursprung

Resident WaehrungTmp4;

Drop Table WaehrungTmp4;


Maybe someone has a tip for me :-).


Greetings

Lisa

0 Replies