Forum Discussion
Promote headers from a specific row
- 6 years ago
This solution takes a slightly different approach.
- Filter for your header row. This will remove all other records in the query except your header row you want. You do not need to know the row number it is on.
- Hit the Append Queries button on the Home tab, and append the table to itself.
- You now have your header row shown twice.
- In the formula bar, replace the second table in the Append operation (the Table.Combine function) with the name of the step directly above the filtered for header row step.
- Now promote the header row.
- Filter the header row out, as it will be duplicated from the Table.Combine operation.
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.
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 ![]()