Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Luca2020
Helper I
Helper I

Transpose Table with multiple column

Hi to all, 

I have the following table: 

Luca2020_0-1696237635492.png

 

I need to transpose it into 

Luca2020_1-1696237663915.png

 

One row per Job, a column with Quantity, H1 and H2 for each phase.

Thanks!

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls this

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJKzUsBUh4gtqEBkDAyUIrVQZUzgskhpJxLS2C6jEyBhLEJupQRxCyYJiNUTYaWQMIEXcYIJgPUEwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Job = _t, Phase = _t, Type = _t, Hours = _t, Quantity = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Job", Int64.Type}, {"Phase", type text}, {"Type", type text}, {"Hours", Int64.Type}, {"Quantity", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Job", "Phase", "Type"}, "Attribute", "Value"),
    #"Merged Columns" = Table.CombineColumns(#"Unpivoted Other Columns",{"Phase", "Type", "Attribute"},Combiner.CombineTextByDelimiter("-", QuoteStyle.None),"type.1"),
    #"Pivoted Column" = Table.Pivot(#"Merged Columns", List.Distinct(#"Merged Columns"[type.1]), "type.1", "Value", List.Sum)
in
    #"Pivoted Column"

View solution in original post

1 REPLY 1
Ahmedx
Super User
Super User

pls this

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJKzUsBUh4gtqEBkDAyUIrVQZUzgskhpJxLS2C6jEyBhLEJupQRxCyYJiNUTYaWQMIEXcYIJgPUEwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Job = _t, Phase = _t, Type = _t, Hours = _t, Quantity = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Job", Int64.Type}, {"Phase", type text}, {"Type", type text}, {"Hours", Int64.Type}, {"Quantity", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Job", "Phase", "Type"}, "Attribute", "Value"),
    #"Merged Columns" = Table.CombineColumns(#"Unpivoted Other Columns",{"Phase", "Type", "Attribute"},Combiner.CombineTextByDelimiter("-", QuoteStyle.None),"type.1"),
    #"Pivoted Column" = Table.Pivot(#"Merged Columns", List.Distinct(#"Merged Columns"[type.1]), "type.1", "Value", List.Sum)
in
    #"Pivoted Column"

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.