Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
Trying to change a column header names using Power Query.
The issue is that as I am doing this to multiple imports the column title isn't "fixed" it is the default "ColumnNN" and it could be any number for "NN". The column headers are the first and last column.
Thanks,
Andrew
Solved! Go to Solution.
Ok no worries. My quick napkin attempt would be something like:
#"Renamed Columns" = Table.RenameColumns(#"Name_of_your_previous_step",{{List.Last(Table.ColumnNames(Name_of_your_previous_step), "RenamedName"}})
Hi @Anonymous
Just so that I understand you have a variable number of columns that are in your source file.
With that being said they are always the first and last columns that will need to be renamed?
And what is that renaming based on?
Hi @GilbertQ,
Thanks for the reply.
Yes it is just the first and last columns where the intervening columns can be variable in number (there is actually one for each day of a month and the sheets are by month).
Column name change is a constant of "Month" and "Booked".
I feel like this recent thread might hold a similar answer:
http://community.powerbi.com/t5/Desktop/Power-Query-keep-first-and-last-columns-only/td-p/187542
Hi @Anonymous,
Yes that was mine as well but it achieved what I wanted to achieve with removing columns but I've tried using it to do rename and unfortuantely my PQ is not good enough to actually effect the change.
Ok no worries. My quick napkin attempt would be something like:
#"Renamed Columns" = Table.RenameColumns(#"Name_of_your_previous_step",{{List.Last(Table.ColumnNames(Name_of_your_previous_step), "RenamedName"}})
@Anonymous,
Thanks for that. Works great!
Almost had it but didn't quite have the syntax with the braces right so sincerely appreciate the assist,
Cheers,
Andrew.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |