Forum Discussion
Fill Adjacent Blank Cells
- 4 years ago
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately. If you have columns other than these, then delete Changed type step and do a Changed type for complete table from UI again)
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjY1VdJRMjIyVYrVgfGQmEamOCQIMmFGmpgawCQgTCNDA2IkwLxYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Master ID" = _t, #"Veh ID" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Master ID", Int64.Type}, {"Veh ID", Int64.Type}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Master ID"}, {{"Temp", each _, type table [Master ID=nullable number, Veh ID=nullable number]}}), //Function Start fxProcess=(Tbl)=> let #"Filled Down" = Table.FillDown(Tbl,{"Veh ID"}), #"Filled Up" = Table.FillUp(#"Filled Down",{"Veh ID"}) in #"Filled Up", //Function ENd #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each fxProcess([Temp])), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Master ID", "Temp"}), #"Expanded Custom" = Table.ExpandTableColumn(#"Removed Columns", "Custom", {"Master ID", "Veh ID"}, {"Master ID", "Veh ID"}) in #"Expanded Custom"
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately. If you have columns other than these, then delete Changed type step and do a Changed type for complete table from UI again)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjY1VdJRMjIyVYrVgfGQmEamOCQIMmFGmpgawCQgTCNDA2IkwLxYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Master ID" = _t, #"Veh ID" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Master ID", Int64.Type}, {"Veh ID", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Master ID"}, {{"Temp", each _, type table [Master ID=nullable number, Veh ID=nullable number]}}),
//Function Start
fxProcess=(Tbl)=>
let
#"Filled Down" = Table.FillDown(Tbl,{"Veh ID"}),
#"Filled Up" = Table.FillUp(#"Filled Down",{"Veh ID"})
in
#"Filled Up",
//Function ENd
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each fxProcess([Temp])),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Master ID", "Temp"}),
#"Expanded Custom" = Table.ExpandTableColumn(#"Removed Columns", "Custom", {"Master ID", "Veh ID"}, {"Master ID", "Veh ID"})
in
#"Expanded Custom"
Thank you Vijay for your answer. I was able to sole this vai transforming the data in excel prior to the bi import.
Thanks again.
Dave