Forum Discussion
Power Query | COALESCE Table and Replace all first row values in Table
- 4 years ago
Hi cflynn_29 ,
According to your description, here's my solution.
1.Add an index column.
2.Add a custom column.
Custom = if[Index]=0 then List.First(List.RemoveItems(#"Added Index"[Column3],{""})) else [Column3]Then the title reaches the first row.
Remove Index and Column3, get the expected result.
Here's the code.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCsksyUlV0oHTSrE60UogGso0BDJMYRwjIMMMrhgkYgzkmcOkTYAMCyC2VIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}), #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type), #"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if[Index]=0 then List.First(List.RemoveItems(#"Added Index"[Column3],{""})) else [Column3]), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column3", "Index"}) in #"Removed Columns"I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi cflynn_29 ,
According to your description, here's my solution.
1.Add an index column.
2.Add a custom column.
Custom = if[Index]=0 then List.First(List.RemoveItems(#"Added Index"[Column3],{""})) else [Column3]
Then the title reaches the first row.
Remove Index and Column3, get the expected result.
Here's the code.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCsksyUlV0oHTSrE60UogGso0BDJMYRwjIMMMrhgkYgzkmcOkTYAMCyC2VIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if[Index]=0 then List.First(List.RemoveItems(#"Added Index"[Column3],{""})) else [Column3]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column3", "Index"})
in
#"Removed Columns"
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.