Showing results for 
Search instead for 
Did you mean: 

Sort issue in Power Query

I have noticed some strange behaviour in Power Query when merging records.


If I have two tables which are sorted based on a date field and then merged, the sort is ignored at the Table.ExpandTableColumn stage of the query. I have noticed this as I had filtered to a single record on one side of the merge before conducting the merge and, once the merged query was expanded, the single record had been replaced by a record which had previously been filtered out.


The other scenario is where I have sorted the data based on a date field and then used Table.Distinct to remove duplicates (this is to only show the latest dated record). The sort order is ignored and a different record is selected - I would expect the first record to be retained.


Unfortunately, I cannot share the data as it is sensitive customer data.


I have found a way around the issues by adding either an index column or by using Table.Buffer. I was just wondering if there is a better solution for this or if this is indeed a bug with the software?

cmaz Regular Visitor
Regular Visitor

Re: Sort issue in Power Query

This could be a bug.

Could you please replicate the issue with dummy data and raise a support ticket?