Forum Discussion
TommyMossberg
5 years agoHelper I
New column - If value = null, use value on previous row.
I got data from my source in a csv formated like this. Got this Got this 4001 Value 4002 Value Value 4003 Value Value Value Value 4004 Value Valu...
- 5 years ago
Just use the Fill down feature. Place the following M code in a blank query to see the steps.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjEwMFTSUQpLzClNVYrVAQsYoQgooEsb45HGxwNqNSFTK05eLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Got this" = _t, #"Got this.1" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Got this", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each [Got this]), #"Filled Down1" = Table.FillDown(#"Added Custom",{"Custom"}), #"Reordered Columns" = Table.ReorderColumns(#"Filled Down1",{"Got this", "Custom", "Got this.1"}) in #"Reordered Columns"Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
AlB
5 years agoCommunity Champion
Just use the Fill down feature. Place the following M code in a blank query to see the steps.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjEwMFTSUQpLzClNVYrVAQsYoQgooEsb45HGxwNqNSFTK05eLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Got this" = _t, #"Got this.1" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Got this", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each [Got this]),
#"Filled Down1" = Table.FillDown(#"Added Custom",{"Custom"}),
#"Reordered Columns" = Table.ReorderColumns(#"Filled Down1",{"Got this", "Custom", "Got this.1"})
in
#"Reordered Columns"
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers