Forum Discussion
Ramon_CN
2 years agoRegular Visitor
Table column to rows
Hello wise Friends, I have the following input table: Ref Conjunt Codi ini Codi Fi Cj1 ini Fi Cj2 ini Fi And would like to transform it in Power Query with the following output ...
- 2 years ago
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs4yVNJRyszLBJJumUqxOiAhIxShWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Ref Conjunt" = _t, #"Codi ini" = _t, #"Codi Fi" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Ref Conjunt", type text}, {"Codi ini", type text}, {"Codi Fi", type text}}), #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Ref Conjunt"}, "Attribute", "Codi"), #"Removed Other Columns" = Table.SelectColumns(#"Unpivoted Other Columns",{"Ref Conjunt", "Codi"}) in #"Removed Other Columns"How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".
lbendlin
2 years agoSuper User
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs4yVNJRyszLBJJumUqxOiAhIxShWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Ref Conjunt" = _t, #"Codi ini" = _t, #"Codi Fi" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Ref Conjunt", type text}, {"Codi ini", type text}, {"Codi Fi", type text}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Ref Conjunt"}, "Attribute", "Codi"),
#"Removed Other Columns" = Table.SelectColumns(#"Unpivoted Other Columns",{"Ref Conjunt", "Codi"})
in
#"Removed Other Columns"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".