Forum Discussion
Merge returning non existent values
- 8 years ago
The cause of your issue is a known phenomenon: if you sort a table and then use Table.GroupBy or Table.Distinct with the sorted table as source, the sort order is not necessarily maintained.
In your case, it means that the nested tables can have a different sort order then the original table.
Apparently you can even have different results in different queries.
The solution is to buffer the sorted table:
#"Sorted Rows" = Table.Buffer(Table.Sort(#"Replaced Values1",{{"HcmWorker_FK_PersonnelNumber", Order.Ascending},{"StartDateLeave", Order.Descending},{"EndDate", Order.Descending}})),
The cause of your issue is a known phenomenon: if you sort a table and then use Table.GroupBy or Table.Distinct with the sorted table as source, the sort order is not necessarily maintained.
In your case, it means that the nested tables can have a different sort order then the original table.
Apparently you can even have different results in different queries.
The solution is to buffer the sorted table:
#"Sorted Rows" = Table.Buffer(Table.Sort(#"Replaced Values1",{{"HcmWorker_FK_PersonnelNumber", Order.Ascending},{"StartDateLeave", Order.Descending},{"EndDate", Order.Descending}})),
I really appreciate(you both) you taking your time to help me with this issue, in particular the work around that you have provided.
Hopefully MS can straighten out this 'known phenomenon',
Thanks again
Tcoe