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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
okletsgo
Advocate II
Advocate II

How to unpivot 3 headers with a two sidebar

I have an excel and the data inside are desgined to be printed in excel so I want to rework on power query. As you can see in the photo there are 3 headers and also 2 "header" in the sidebar. I have tried so many step to use unpivot, transpose, merge etc without getting to work. Could someone please help what would be the step to get this done?1.png 

2 REPLIES 2
amitchandak
Super User
Super User

Refer

https://radacad.com/pivot-and-unpivot-with-power-bi

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

You want to transpose, fill down, add a column for pivoting and put it at the front.
Remove COlumn1 and 2, transpose back, promote header and unpivot other column.
you can now split your pivoted column back to their original values
Sample code is below as a demo 

Not the simplest transform, but it gets the job done.

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Transposed Table" = Table.Transpose(Source),
    #"Filled Down" = Table.FillDown(#"Transposed Table",{"Column1"}),
    AddPivotHeader = Table.AddColumn(#"Filled Down", "PivotHeader", each [Column1] & "-" & [Column2]),
    #"Removed Columns" = Table.SelectColumns(AddPivotHeader,
{"PivotHeader"} & List.Select( Table.ColumnNames(AddPivotHeader), 
each not List.Contains({"Column1","Column2","PivotHeader"}, _))),
    #"Transposed Table1" = Table.Transpose(#"Removed Columns"),
    #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table1", [PromoteAllScalars=true]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Promoted Headers", {"Column1"}, "Attribute", "Value"),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByDelimiter("-", QuoteStyle.Csv), {"FirstRow", "SecondRow"})
in
    #"Split Column by Delimiter"

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.