Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I am sooo tired of repeating the pattern of renaming and reordering columns in M query result sets, and then mucking around when I decided that the names need to be different from what I originally picked which then breaks the subsequent reordering.
I'd like to see a single command, let's call it Table.RenameAndReorder that does both at once. The renaming is obvious. The reordering is done based on the sequence of the renaming pairs that are provided.
Related to that, it would be great if the advanced editor put a carriage return between each pair of columns within those commands.
This would save much time and frustration.
Solved! Go to Solution.
I've taken your suggestion and developed a custom ArrangeTableColumns function that allows me to set the desired names, order, and datatypes for all of the columns in a single call. This allows me to modify any of those settings in one place without breaking subsequent lines of code. So, objective achieved! Thanks for that!
The problem is... this custom function is not wired into the lovely Power Query UI so it can't be generated automatically. Writing the function call in the first place is quite a chore. So, I created a custom function that generates the call for me based on a specified input table. A bit clunky but it works if you use it at the right time.
I would still love to see a feature added to Power Query that allows us to rename, reorder, and retype all at once; and then change any of those settings without breaking subsequent lines of code.
Hi @dhodgman ,
Could you please confirm if you've submitted this as an idea in the Ideas Forum? If so, sharing the link here would be helpful for other community members who may have similar feedback.
If we don’t hear back, we’ll go ahead and close this thread. For any further discussions or questions, please start a new thread in the Microsoft Fabric Community Forum we’ll be happy to assist.
Thank you for being part of the Microsoft Fabric Community.
Hi @dhodgman ,
Thanks for reaching out to the Microsoft fabric community forum.
Currently, there isn't a single native command in Power Query (M) that combines both Table.RenameColumns and Table.ReorderColumns. However, I understand your frustration, and I would like to suggest the following approach:
Please refer to the below link for more information:
Table.RenameColumns - PowerQuery M | Microsoft Learn
Table.ReorderColumns - PowerQuery M | Microsoft Learn
Below link will helps to navigate the steps for custom function:
I hope my suggestions give you good ideas, if you have any more questions or need further assistance, feel free to let me know.
If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Thank you.
Hi @dhodgman
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
I've taken your suggestion and developed a custom ArrangeTableColumns function that allows me to set the desired names, order, and datatypes for all of the columns in a single call. This allows me to modify any of those settings in one place without breaking subsequent lines of code. So, objective achieved! Thanks for that!
The problem is... this custom function is not wired into the lovely Power Query UI so it can't be generated automatically. Writing the function call in the first place is quite a chore. So, I created a custom function that generates the call for me based on a specified input table. A bit clunky but it works if you use it at the right time.
I would still love to see a feature added to Power Query that allows us to rename, reorder, and retype all at once; and then change any of those settings without breaking subsequent lines of code.
Hi @dhodgman,
I'm glad to hear that you've successfully created a custom ArrangeTableColumns function to rename, reorder, and retype columns in one call. While it isn't integrated into the Power Query UI, your workaround is a great solution for now.
I understand your desire for a built-in feature to simplify this process further. Hopefully,Microsoft will consider adding this functionality in the future.
In below link add your idea or suggestion to microsoft:
Home
If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Thank you.
Hi @dhodgman
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @dhodgman ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @dhodgman,
I wanted to follow up on our previous suggestions regarding Feature Request.
If my response has addressed your query, please accept it as a solution and give a ‘Kudos’ so other members can easily find it. Please let us know if there’s anything else we can do to help.
Thank you.
Hi @dhodgman
If you're using a source like SQL Server, you can rename and reorder the columns directly in the SQL query before loading the data into Power Query. This approach avoids the need to use both Table.RenameColumns and Table.ReorderColumns later.
For example, you can write:
sql
Copy code
SELECT
Column1 AS NewName1,
Column3 AS NewName3,
Column2 AS NewName2
FROM YourTable;
This query renames the columns and defines their order simultaneously, so the data arrives in Power Query exactly as you need it.
That said, if you’d like a combined Table.RenameAndReorder function in Power Query, I recommend submitting it as an Idea in the Power BI Ideas forum, where Microsoft reviews suggestions for future improvements , here is a link :
https://ideas.fabric.microsoft.com/
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Correction... turns out I can't access the ideas forum in my current work situation.
Perhaps someone can cross post it if you think it's a worthwhile suggestion.
Thanks for your response @Ritaf1983. Your suggestion is appropriate when pulling a result set from any database. In my current gig, I'm having to pull data from a cube 😞 which is not so simple to work with. And thanks for the link to the ideas forum. I will cross post there.