How to have multiple column sorts in Power BI desktop/online with directquery

ivric picture ivric · Dec 15, 2017 · Viewed 11.4k times · Source

I have matrix visualization with multiple columns say:

ProjID ProjName Budget Proj_Status project_duration

I want to do a multiple column sort (like in Excel) first on Budget then on Project_duration in Power BI.

Answer

point71echo picture point71echo · Mar 29, 2018

From the Query Editor, sort by one column then edit the formula to include the second column like this...

= Table.Sort(#"Reordered Columns1",{{"OrdersCount", Order.Descending},{"OrderDate", Order.Descending}})

You must comma-delimit each column header and ordering option within curly braces.

Example:

{{"1st_Sorted_Column_Header",Order.Ascending},{"2nd_Sorted_Column_Header",Order.Descending},{"3rd_Sorted_Column_Header",Order.Descending}}