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
ValeriaBreve
Post Partisan
Post Partisan

Promote Headers on Selected Columns

Hello,

I need to build a table based on an Excel file, where the columns headers need to come from different rows.

Say that for columns 1-10 the columns headers are on row 15, whereas for columns 11-200 the columns headers are on row 16.

 

How can I reach this? 

Many thanks in advance for your help!

kind regards

Valeria

1 ACCEPTED SOLUTION
rohit_singh
Solution Sage
Solution Sage

Hi @ValeriaBreve ,

Please try this logic as shown below :

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8kvMTVXSUXLOLKkEUfmleSVFIBYIxepEK0GZOkquuYmZOUA6ICM/LxUsFREZBeQnJiUDyYLCIiBZUVnlkJSnl5yfC+SYWpqamhkbGRspxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}}),
    #"Transposed Table" = Table.Transpose(#"Changed Type"),
    #"Merged Columns" = Table.CombineColumns(#"Transposed Table",{"Column1", "Column2"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"Merged"),
    #"Transposed Table1" = Table.Transpose(#"Merged Columns"),
    #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table1", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Name", type text}, {"City", type text}, {"Country", type text}, {"Email", type text}, {"Phone", Int64.Type}})
in
    #"Changed Type1"

 

Input data 

rohit_singh_0-1661441815094.png

Transpose the table

rohit_singh_1-1661441841035.png

Merge the columns with the headers to get a single column

rohit_singh_2-1661441877792.png

Transpose the table again

rohit_singh_3-1661441900983.png

Promote headers

rohit_singh_4-1661441924491.png

 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos!

 

 

View solution in original post

2 REPLIES 2
ValeriaBreve
Post Partisan
Post Partisan

good solution! Thanks I had not thought of it 🙂

rohit_singh
Solution Sage
Solution Sage

Hi @ValeriaBreve ,

Please try this logic as shown below :

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8kvMTVXSUXLOLKkEUfmleSVFIBYIxepEK0GZOkquuYmZOUA6ICM/LxUsFREZBeQnJiUDyYLCIiBZUVnlkJSnl5yfC+SYWpqamhkbGRspxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}}),
    #"Transposed Table" = Table.Transpose(#"Changed Type"),
    #"Merged Columns" = Table.CombineColumns(#"Transposed Table",{"Column1", "Column2"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"Merged"),
    #"Transposed Table1" = Table.Transpose(#"Merged Columns"),
    #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table1", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Name", type text}, {"City", type text}, {"Country", type text}, {"Email", type text}, {"Phone", Int64.Type}})
in
    #"Changed Type1"

 

Input data 

rohit_singh_0-1661441815094.png

Transpose the table

rohit_singh_1-1661441841035.png

Merge the columns with the headers to get a single column

rohit_singh_2-1661441877792.png

Transpose the table again

rohit_singh_3-1661441900983.png

Promote headers

rohit_singh_4-1661441924491.png

 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos!

 

 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.