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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Richard_WQE
New Member

Sort By Column (non-unique values)

I work in 6th Form College and we're just getting started with Power BI to analyse student progress throughout the year.

I've got a simple matrix that I want to sort differently.

Richard_WQE_1-1680686081777.png

 

For GCSEs this should go 9 down to 1 then U then X then Invalid.  I've set up a numeric "grade rank" for each grade at each subject level but because values like "U", "X" and "Invalid" aren't unique to any subject level (e.g. GCSEs, A-levels, BTECs could all get "U" grades), Power BI doesn't let me use my grade rank to sort the grade using Sort By Column.

 

I've tried using grade rank as a lookup field in the data set and as a linked table.  Neither way lets me sort within the data set and as far as I can tell, I can only sort the matrix visual by fields I put in the matrix (I tried to put grade rank in and then set it to hide in report, but that didn't seem to do anything).

 

Any ideas?

 

Version: 2.115.663.0 64-bit (March 2023)

6 REPLIES 6
joaoribeiro
Impactful Individual
Impactful Individual

Hi @Richard_WQE ,

 

Can you please share how you created the numeric grade rank?

Thanks!

The data is from a view so I created a table on the server listing all possible grade-subject level combinations and manually ranked them best-to-worst.  I linked the table to to view.

I've also tried importing the table as its own data set and linking within Power BI Desktop.  I can look the correct values up this way, but I can't sort on them.  😞

Hi @Richard_WQE , thank you for your explanation.

 

In this new table, were you able to "sort by column" based on your custom rank? If so, in order to use this new column to sort the grades in the wanted way, I suggest you creating a relationship between the 'sort table' and the 'original table', and then use the column from the 'sort table' instead of the original one in the visuals (matrix in this case).

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️or giving it a kudoe 👍

Thanks!
Best regards,
Joao Ribeiro

I cannot.  Same error as when I try within the main table.

Richard_WQE_1-1680689190188.png

The grade (in this case the Minimum Expected Grade) isn't unique because, as before, different subject levels can have same grade, so grade isn't unique.

 

I see! Unfortunately, there is no workaround for the sort by column without unique values. In this case, can't you create the sorting rank based on the combination of two columns (subject-level)?

I did try that, but as the new subject-level/grade field isn't in the matrix I can't sort by it.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors