Forum Discussion
Sorting row or column values in a specific order
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.
- Anonymous6 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.
- mjantune6 years agoRegular Visitor
is [Lob] a measure or a Column?
You could also create a new table (Sort_Lob) to do the sorting.
LOB Sort_LOB Accounts 1 Esc Accounts 2 Billing 3 Esc billing 4 Tech 5 Esc Tech & hardware 6 Then you relate this table to the Employee_Team table you want to sort, and use this Sort_Lob table in the report.
- Anonymous6 years agoNot applicable
[LOB] is a field/column from a SQL table.
- amitchandak6 years agoSuper User
Anonymous , Create a new column
Lob Name = [LOB]
and use this and also set a sort column on this. You can not use a derived column as sort column for the base column
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
- Anonymous6 years agoNot applicable
So I did this. I created a new column LOBName = LOB then changed Sort_LOB to be based on LOBName and not LOB.
Then I created the visual using LOB but sorted based on LOBName but it still generated the circular dependency error.