Power Query: Promoting/Demoting Headers

jajatidev

Board Regular
Joined
Jul 29, 2016
Messages
78
Office Version
  1. 365
Platform
  1. Windows
Hi,
The "Report Date" column is from the Expanded Data step.

After expanding all column headers are in the first row except for Report Date, due to this when I promote the headers the data in Report Date Column gets promoted at the column header which I then rename.
Renaming is causing the query to break because the date keeps changing.

If I have to demote then how do I demote the Report Date header name only
If I have to promote then how do I promote Header Names except for Report Date

Please advise.

Thanks.

1715712622205.png


1715712584559.png


1715712697581.png
 

Attachments

  • 1715712669341.png
    1715712669341.png
    7.8 KB · Views: 7

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
After you promote first row to headers, add a step like

Power Query:
ReportDateHeading = Table.ColumnNames(#"Promoted Headers"){0}

then to change the Heading to "Report Date"

Power Query:
tbl = Table.RenameColumns(#"Promoted Headers",{{ReportDateHeading, "Report Date"}})
 
Upvote 0
Solution
After you promote first row to headers, add a step like

Power Query:
ReportDateHeading = Table.ColumnNames(#"Promoted Headers"){0}

then to change the Heading to "Report Date"

Power Query:
tbl = Table.RenameColumns(#"Promoted Headers",{{ReportDateHeading, "Report Date"}})
Thank you, Gordon.
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,138
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top