Forum Discussion
Anonymous
6 years agoNot applicable
Sorting row or column values in a specific order
Hi, this is a 2-part question. Part #1: I followed a previously published solution: https://community.powerbi.com/t5/Desktop/Sorting-rows-and-columns-in-matrix-visual/m-p/723838#M349347 to try ...
mjantune
6 years agoRegular Visitor
Part #1:
Is the "Sort_LOB" field a calculated column? If it is, you should use sort by column in the Data View
You select the "LOB" column and you sort by the Sort_LOB column.
Instead of using IF, its better to use SWITCH.
Sort_LOB = SWITCH( [LOB] ,
"Accounts", 1 ,
"ESC Accounts", 2 ,
"Billing" , 3 ,
"ESC Billing" , 4 ,
"Tech" , 5 ,
"ESC Tech & Hardware" , 6 ,
7
)
--- 7 is for any other values
Part 2:
Here is a post explaining how to sort by custom orders.
http://www.excelnaccess.com/custom-sorting-in-power-bi/
You could use the same method as in the row order.
I hope this helps.
Anonymous
6 years agoNot applicable
Re. Part #1
I changed the Sort_LOB calculated column to the SWITCH dax, then I selected LOB and sorted by Sort_LOB, and encountered and error message - screenshot attached.