Power Query Preserve column sort/filter/layout

Copper Contributor

In Excel 2016, Version 1705 (Build 8201.2193), if I have a query from Get & Transform that is returned to the worksheet, it reorders the columns to match what is in the query editor every time I refresh - even if I check the box to "Preserve column sort/filter/layout" in External Data Properties.  In previous versions, checking this box would maintain whatever column order is in the worksheet and new columns would be added at the end.  Is there a new setting somewhere that I can set so it doesn't change the column order each refresh?

7 Replies
Hi Chris,

I hadn't noticed that change, but I can see what you mean. I guess it would be best practice to sort your columns in Power Query editor anyway but an interesting change of how things work...
Just wanted to follow up on this query. Had anyone had any luck with resolving this? I’ve tried all the external data options and it seems like the button for “preserve column sort/layout” doesn’t do anything in Excel 365. It worked fine in Excel 2013 with PQ addin.

I still find this to be an issue. Hopefully Microsoft will address this issue. Weird that it would work perfectly in 2013 but then not in subsequent versions. @Chris Rankin 

@Chris Rankin I know it's been a long time but I've been looking for an answer to this problem for a long time and found it on an even older thread: unchecking the "Add this to the Data Model" option in the "Load To..." settings, makes the data sorting in the table the same as the one seen in the query preview.

Source: https://chandoo.org/forum/threads/power-query-sorting.23455/

@claudiapeitzp 

You may wrap previous step with Table.Buffer, or, alternatively, add Index before sorting and remove after that.

In my case (and the other users’ in the source forum I posted too), adding the row index and sorting by it would still load the query to the table in an differently sorted way. This means I would have to sort the index column in excel every time I refreshed the table, which is not a practical solution either. I believe this is some kind of bug, but I’ve only been working with power query in excel for a couple of months.

@claudiapeitzp 

Did you try Table.Buffer() ?