Forum Discussion
Index column in power query based on date sorting
Hi lenafherold ,
It looks from your screenshot that it's working fine.
Power Query sometimes jumbles up the rows on certain operations e.g. merges etc., but it has also jumbled the index accordingly, so your cumulative sums are still calculating in the right order.
In the instance that sorted dates all have equal values (as yours mostly do), I believe the sort then reverts to the left-most column order, then next one etc. As such, when you apply this to the model, and the AS engine swaps all your columns around, then you sort again on your date column, the sort criteria has changed and therefore so does your sort order. In this instance, you should sort on the index column in the data model to get back to exactly the same order the rows were in when you applied the index in PQ.
Not sure if there was another issue that I missed?
Pete