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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have created a function which renames my columns based on the criteria I need with numbers in all the column headers.
So I need to order these columns based on these numbers in ascending order. See the below code where I manually ordered the columns.
Table.ReorderColumns(RemoveColumns,{"Viewfolder 1", "Viewfolder 2", "View 2", "Viewfolder 3", "View 3"})This is a sample case with just 5 columns, but I have excel files with 100's of columns to order.
I prefer it if "viewfolder" is placed before "view", but it's not mandatory. Is there any way to achieve this using "M"
Solved! Go to Solution.
You should be able to add a new step in Power Query as follows:
Home > Choose Columns > Select All Columns > Sort A-Z > Name
as shown in the YouTube video Easy Trick for Sorting Columns in Power Query
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 57 | |
| 43 | |
| 40 | |
| 21 | |
| 17 |