Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
iGi
Advocate I
Advocate I

Custom Sorting in PowerBI?

Hello all, 

 

Seeing as how helpful people were with my last two questions, I thought I'd ask another, which has been nagging me. 

 

I'm aware of the sorting function in graphs, but that seems to sort the items alphabetically. 

 

What I'm hoping to do is sort non-alphabetically, in an order that makes sense otherwise - highest to lowest, or whatever the case. 

See here: 

PowerBI Sorting Question.png

 

I'd like it to read Critical, High, Medium, Low. Is there anything I can do here? 

 

Thank you!

1 ACCEPTED SOLUTION
v-haibl-msft
Microsoft Employee
Microsoft Employee

@iGi

 

You can create a table like following one and create relationship with the original table.

Custom Sorting in PowerBI_1.jpg

 

Then create a calculated column in original table with following formula.

Column = RELATED( Table2[ID] )

Custom Sorting in PowerBI_2.jpg

 

At last, select the Type column and make it sorted by above created column.

Custom Sorting in PowerBI_3.jpg

 

Custom Sorting in PowerBI_4.jpg

 

Best Regards,

Herbert

View solution in original post

27 REPLIES 27

All these workarounds for just a simple sort task, unbeleivable how difficult it is

 

I just can't get this crap worked out

I agree this is a HUGE faff for such an obvious requirement!  I am sure this is possible in Tableau.  Is there anywhere this has been logged as a suggestion that we can upvote, and try and get it on the roadmap?

Anonymous
Not applicable

Agreed! This is such a basic feature, why it requires such a workaround seems absurd!

Great tips! Thanks! Its a long way around from what should be a custom sort or drag feature link in a pivot table. Will be available some time I guess.

@v-haibl-msft I got it! I was editing the query earlier, not realizing that I should just go through the Modeling tab under the table. 

Anyway, I was able to select "ID" from the new table: 

Formula.png

 

Sorted the Risk Rating column as you said, saved and the change took. 

 

Learned something new today. 🙂

 

Thank you!

 

@v-haibl-msft

Since I'm unfamiliar with this, I'm getting stuck at adding a new column and referencing the ID column from the newly created table. 

 

Here is where I am: 

 

1. Added a new table with Risk and ID columns:

New Table.png

 

2. Created a link between the two tables on Risk Rating and Risk:

Link.png

 

3. Clicked on Custom Column and the only columns available to me are those in the original, primary table and I don't know how to reference the new "Risk Order" table in the formula: 

Inserting column.png

 

Any advice? 

@v-haibl-msft Wow! Didn't even think of doing that. Thank you! I'll give this a try to see if it will work with the larger table that I'm using here. 

 

On a separate note, how did you learn this? It resembles SQL to me. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.