Home:ALL Converter>Power BI / DAX: Sort Calculated Table by Calculated Column

Power BI / DAX: Sort Calculated Table by Calculated Column

Ask Time:2021-10-24T11:13:36         Author:Declan

Json Formatter

I have a Power BI data model with a DAX calculated table used as a dimension that is calculated with VALUES from a fact table with multiple occurrences of each value, so it is a 1:M relationship.

In my report I want to use the calculated table values as a slicer with the options presented in a specific order other than alphabetical. Therefore in the calculated table, I created a calculated column that assigns a number to each row based on a SWITCH function. However, when I then try to "Sort by Column" in Power BI, it throws an error indicating that it is a circular reference. How else can I define the sort order?

Here is an example data/calculated tables:

'Source' fact table:

Dimension_Values
a_order_third
a_order_third
b_order_first
b_order_first
c_order_second
c_order_second

Author:Declan,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/69693598/power-bi-dax-sort-calculated-table-by-calculated-column
yy