One approach, calling [`ReverseSort`](https://reference.wolfram.com/language/ref/ReverseSort.html) only on the relevant data: ``` (ReverseSort@Most@Query[All,"22"]@data//Keys//Append["Total"]//Query)@data//Dataset ``` [![enter image description here][1]][1] **Original Answer** Query[ReverseSort[Query[;;-2,-1]@data]//Keys//Append["Total"]]@data [1]: https://i.sstatic.net/QInvE.png