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 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is 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.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 30 | |
| 28 | |
| 22 | |
| 21 | |
| 19 |
| User | Count |
|---|---|
| 44 | |
| 32 | |
| 18 | |
| 17 | |
| 17 |