You can sort the results of your query and achieve the same result as an "ORDER BY" SQL statement. Use the ´Column options´ and select the relevant columns in the ´Sorting´ tab.
Alternatively, could you could create an Analytic view and then work on the grouping / aggregating your results in Power BI with much more flexibility than directly in Azure DevOps.