Should have written this blogpost ages ago, as I've often come across people complaining that removing duplicates doesn't work as expected.
What's going on?
When duplicates are removed, only the first occurances of the values are kept. Therefore people often sort their data as desired before hitting the remove duplicates button. Later on, they see that not the right items are kept.
This will keep the sort order for the next step reliably.
Other functions with unexpected behaviour
This is something that should have made it into the functionn documentation, but so far hasn't. Therefore I've created an alternative documentation series where I've mentioned "unexpected behaviour" like that: https://github.com/ImkeF/M-Guide
Do you know other functions that don't behave as expected? Please let me know in the comments or contribute to the GitHub repo.