programsam
Board Regular
- Joined
- Feb 10, 2016
- Messages
- 123
Looking to rename columns with dates in them as the MonthName and Year only using PQ. Not every column has a date so it would have to parse the list of column headers, find the one's with dates (all the first day of the month - '1/1/2023', '2/1/2023', etc.). The best I've done thus far has returned the month name but it does not display the year, it only shows the formatting for the year ("YYYY").
For clarity, the columns look like this.
What I'm wanting is: "July 2022"
What I'm getting using the code below is "July YYYY"
For clarity, the columns look like this.
What I'm wanting is: "July 2022"
What I'm getting using the code below is "July YYYY"
Excel Formula:
= Table.TransformColumnNames((#"Renamed Columns1"),each try Date.FromText(Table.ColumnNames((#"Renamed Columns1"){n}), otherwise _))