Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have a need to promote headers from row 18. Is there any way to promote headers from a specific row in power query?
Since I also need to reference data from rows 1-17 after promoting the headers from row 18, solutions such as "delete first 17 rows" or "promote rows 18 times" is not a solution for this.
If anyone knows a solution for this, i'd appreciate it!
Solved! Go to Solution.
This solution takes a slightly different approach.
let Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Data", type text}}), #"Filtered for header row" = Table.SelectRows(#"Changed Type", each ([Data] = "Header Row")), #"Appended Query" = Table.Combine({#"Filtered for header row", #"Changed Type"}), #"Promoted Headers" = Table.PromoteHeaders(#"Appended Query", [PromoteAllScalars=true]), #"Filtered out header row" = Table.SelectRows(#"Promoted Headers", each ([Header Row] <> "Header Row")) in #"Filtered out header row"
So the steps will look like those below. Note I've manually renamed a few. The "Appended Query" step is appending the table created by the "Changed Type" step below the single record table created by the "Filtered for header row" step.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingVery well explained. Thanks!
This solution takes a slightly different approach.
let Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Data", type text}}), #"Filtered for header row" = Table.SelectRows(#"Changed Type", each ([Data] = "Header Row")), #"Appended Query" = Table.Combine({#"Filtered for header row", #"Changed Type"}), #"Promoted Headers" = Table.PromoteHeaders(#"Appended Query", [PromoteAllScalars=true]), #"Filtered out header row" = Table.SelectRows(#"Promoted Headers", each ([Header Row] <> "Header Row")) in #"Filtered out header row"
So the steps will look like those below. Note I've manually renamed a few. The "Appended Query" step is appending the table created by the "Changed Type" step below the single record table created by the "Filtered for header row" step.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingM can produce an efficient solution.
Skip the first 17 rows and promote headers like you normally would. These steps return the bottom of the query. Now go back to the source and keep the first 17 rows. Rename the top by zipping the column names of the top and the column names of the bottom. Finally, append the top and bottom together. Sample is below:
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], #"Removed Top Rows" = Table.Skip(Source,17), Bottom = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]), SourceTop = Table.FirstN(Source,17), Top = Table.RenameColumns(SourceTop,List.Zip({Table.ColumnNames(Source), Table.ColumnNames(Bottom)})), Custom1 = Top & Bottom in Custom1
Hi @Anonymous
You could do something like this
1. Add an index (or use another column to identify row 18, I assume you have one already)
2. Create a custom column that returns for instance "Promote" when the index is 18 and null otherwise.
3. Sort the custom column in descending order so that the row with "Promote" is on top
4. Promote first row to headers, as usual
5. Delete the two auxiliary columns we just created
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.