cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Gangula Regular Visitor
Regular Visitor

Reorder columns based on column headers

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"

1 ACCEPTED SOLUTION

Accepted Solutions
NickNg278 Senior Member
Senior Member

Re: Reorder columns based on column headers

@Gangula,

This post should have the solution you are looking for. 

View solution in original post

2 REPLIES 2
NickNg278 Senior Member
Senior Member

Re: Reorder columns based on column headers

@Gangula,

This post should have the solution you are looking for. 

View solution in original post

Gangula Regular Visitor
Regular Visitor

Re: Reorder columns based on column headers

Thank you, that helped.

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 254 members 2,397 guests
Please welcome our newest community members: