Forum Discussion
Reordering Row Contents into different Columns based on Cell Content Query
- 5 years ago
Hello campbellmurphy
some unpivoting, splitting column and pivoting again should do the trick
Here the complete code
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs7JTM0rMVTSUTIy0TewULAEsowNQSxDENPQAMQ0A7HMQSwTpVgdmCYjuFJjkDxQu6WCEVylAZBlYA4SM0TSYwyXN4JbaXxoAcJSuC6gTbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]), #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"(blank)"}, "Attribute", "Value"), #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}), #"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns", "Value", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Value.1", "Value.2"}), #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"(blank)", type text}, {"Value.1", type date}, {"Value.2", Int64.Type}}), #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Changed Type", {{"Value.1", type text}}, "de-DE"), List.Distinct(Table.TransformColumnTypes(#"Changed Type", {{"Value.1", type text}}, "de-DE")[Value.1]), "Value.1", "Value.2", List.Sum) in #"Pivoted Column"Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello campbellmurphy
some unpivoting, splitting column and pivoting again should do the trick
Here the complete code
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs7JTM0rMVTSUTIy0TewULAEsowNQSxDENPQAMQ0A7HMQSwTpVgdmCYjuFJjkDxQu6WCEVylAZBlYA4SM0TSYwyXN4JbaXxoAcJSuC6gTbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"(blank)"}, "Attribute", "Value"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns", "Value", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Value.1", "Value.2"}),
#"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"(blank)", type text}, {"Value.1", type date}, {"Value.2", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Changed Type", {{"Value.1", type text}}, "de-DE"), List.Distinct(Table.TransformColumnTypes(#"Changed Type", {{"Value.1", type text}}, "de-DE")[Value.1]), "Value.1", "Value.2", List.Sum)
in
#"Pivoted Column"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy