Forum

Use an external lis...
 
Notifications
Clear all

Use an external list to sort columns in Power Query

3 Posts
2 Users
0 Reactions
109 Views
(@greenboy)
Posts: 25
Topic starter
 

I appreciate this may be a non starter, but is there a way to sort the columns in a data set in PQ, using an external list of the columns you want in order?

My situation is that I am provided with a set of data, that is quite frankly a holy mess. It has approx 150 columns, and the owner of the database is unresponsive to requests to sort the columns into a logical order from which I need to pull a growing number of reports.

It is quite a long and very laborious task to arrange the columns as well as selecting those to keep for a task.

If I create a list of the columns I need in a worksheet, in the order I need them, is there a way to import this into PQ and get it to re-order the columns to suit?

I appreciate that after i have done it once, i can copy the m code to use again, but this would be a handy thing to be able to do from the outset.

 

Thanks in advance for any responses.

Dave

 
Posted : 20/05/2018 6:16 am
(@greenboy)
Posts: 25
Topic starter
 

Just an update - i havent found a way to do this with an external source, however i have found the Choose Columns function, which allows the mass deletion of columns not required... from there sorting is fairly simple.

Thanks 

Dave

 
Posted : 21/05/2018 5:57 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Dave,

I don't know a way to sort columns from an external list either, but you could create the line of M code outside of Power Query and copy it in, if that's any help.

Although it sounds like the Choose Columns function has helped alleviate some of the pain already 🙂

Mynda

 
Posted : 21/05/2018 7:02 pm
Share: