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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
shairado
Frequent Visitor

How to Pivot multiple two column with values to a Flat format

Hi,

 

I am trying to use Power-Query to Pivot Data of multiple columns, but only able to get 1 column pivoitzed.

 

I have a table, where each 'Proj#' has 3 milestones, and each milestone has 2 columns with properties I want to flat - 'Value' and 'Date'.

 

This is the format of the original table:

Orig Table.PNG

 

 

 

 

And this is the desired result, where each 'Proj#' has 1 row, and 6 columns:

Required Table.PNG

 

Any help would be great.

 

Thanks,

Shai

1 ACCEPTED SOLUTION
AlienSx
Super User
Super User

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Proj#", "Milestones"}, "Attribute", "Value.1"),
    #"Merged Columns" = Table.CombineColumns(#"Unpivoted Other Columns",{"Milestones", "Attribute"},Combiner.CombineTextByDelimiter(" - ", QuoteStyle.None),"Merged"),
    #"Pivoted Column" = Table.Pivot(#"Merged Columns", List.Distinct(#"Merged Columns"[Merged]), "Merged", "Value.1")
in
    #"Pivoted Column"

View solution in original post

2 REPLIES 2
shairado
Frequent Visitor

@AlienSx  thank you, worked great.

AlienSx
Super User
Super User

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Proj#", "Milestones"}, "Attribute", "Value.1"),
    #"Merged Columns" = Table.CombineColumns(#"Unpivoted Other Columns",{"Milestones", "Attribute"},Combiner.CombineTextByDelimiter(" - ", QuoteStyle.None),"Merged"),
    #"Pivoted Column" = Table.Pivot(#"Merged Columns", List.Distinct(#"Merged Columns"[Merged]), "Merged", "Value.1")
in
    #"Pivoted Column"

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 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.