Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hi Power BI Community!
I have this calculated column:
Recreate your calculated column as another column but instead of having the expected value you want in your SWITCH, you just put integers 1 to 5. See formula below.
You can't sort a calculated column, by the column it's derived from.
But you could make a second calculated column, and sort your original calculated column by that.
Target Data HQ Sort =
var _diff = TrackET[Aver. Note to delivery h]
return
Switch ( True() ,
_diff <= 42, 1 ,
_diff <= 48, 2 - Target Unscheduled Tool Down" ,
_diff <= 72, 3 ,
_diff <= 96, 4- Target Scheduled Tool Down",
_diff <= 196, 5- Target Tool up/Replenishment",
6
)
Then go to [Column Tools] > [Sort By Column] and sort your original calculated column, by that new column.
And probably hide that 'sort' column from your data model, so as to not confuse anyone.
@mmace1 Thanks for the reply!
But I have this error because of the second calculated column:
Is [Target Data HQ Sort] defined by [Target Data HQ]? Because you can't do that, or it'll throw the circular dependency error when you try to sort.
[Target Data HQ Sort] needs to be defined by a 3rd column that's just
TrackET[Aver. Note to delivery h]
Example I just made locally: The Switch column is defined by Original, and the Swithc Sort Column is also defined by Original. Then I can sort the Switch Column, By Switch Sort Column, fine without an error.
So your last entry is the literal number 6, while the rest are strings - i'e "5- Target...bla bla". I think that'd throw an error once you get there.
I have an example file here:
https://www.dropbox.com/s/729i58ovutw1fvv/Example.pbix?dl=0
I think probably your issue is that you're switch statement on your sort column, is still pointing to the Measure, instead of an actual column. I think you'd need a column with [Avg. Note to delivery h], then reference that column for both your SWITCH column , and your SORT column.
I don't suppose you can upload your file?
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 26 | |
| 23 | |
| 19 | |
| 18 | |
| 15 |
| User | Count |
|---|---|
| 46 | |
| 44 | |
| 43 | |
| 36 | |
| 31 |