Forum Discussion

LeonardSchwenk's avatar
LeonardSchwenk
Frequent Visitor
3 years ago
Solved

Replace null values by max value by key

I have opened a Dataflow and now I want to fill out missing dates by key.

My data Looks like this :

idnumbertypeINDEXDATUM
25000001002.03.21
250000110 
250000210 
2500003250 
2500004251 
2500005252 
250000610 
25000101026.02.21
250001110 
250001210 
250001310 
250001410 
250001510 
250001610 
250001710 
250001810 
250001940 
25000110170 
25000111220 
25000201016.03.21
250002110 
250002210 
2500023250 
2500024251 
2500025252 
250002610 

 

What I want to achive:

idnumbertypeINDEXDATUM
25000001002.03.21
25000011002.03.21
25000021002.03.21
250000325002.03.21
250000425102.03.21
250000525202.03.21
25000061002.03.21
25000101026.02.21
25000111026.02.21
25000121026.02.21
25000131026.02.21
25000141026.02.21
25000151026.02.21
25000161026.02.21
25000171026.02.21
25000181026.02.21
25000194026.02.21
2500011017026.02.21
2500011122026.02.21
25000201016.03.21
25000211016.03.21
25000221016.03.21
250002325016.03.21
250002425116.03.21
250002525216.03.21
250002610 16.03.21


I tried some if and listes but nothing worked so far.
if date = null then get max(date) where ID = ID
else date


  • Hi LeonardSchwenk ,

     

    It looks like you should just be able to select your [DATUM] column then go to the Transform tab > Fill (dropdown) > Down.

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fZJhCoAgGEOvEv4OcUutzhLd/xqVaFg6BRF8gt8bOw7D4O5lZvNs5NPRusUS5pyrF6heTF9EjZYHhz7zhaFloTC2LPa/w0+D0d4mtQa0BrQGsoZAXqOg0cBh1WjTaM+jdBBSKquAyZwtLFdvrPHfipJXZyLqODloBQet4KAVbBM9Lw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, number = _t, #"type" = _t, INDEX = _t, DATUM = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"DATUM", type date}}),
        #"Filled Down" = Table.FillDown(#"Changed Type",{"DATUM"})
    in
        #"Filled Down"

     

    Pete

1 Reply

  • Hi LeonardSchwenk ,

     

    It looks like you should just be able to select your [DATUM] column then go to the Transform tab > Fill (dropdown) > Down.

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fZJhCoAgGEOvEv4OcUutzhLd/xqVaFg6BRF8gt8bOw7D4O5lZvNs5NPRusUS5pyrF6heTF9EjZYHhz7zhaFloTC2LPa/w0+D0d4mtQa0BrQGsoZAXqOg0cBh1WjTaM+jdBBSKquAyZwtLFdvrPHfipJXZyLqODloBQet4KAVbBM9Lw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, number = _t, #"type" = _t, INDEX = _t, DATUM = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"DATUM", type date}}),
        #"Filled Down" = Table.FillDown(#"Changed Type",{"DATUM"})
    in
        #"Filled Down"

     

    Pete