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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
eshetb
Frequent Visitor

sort a non-unique column by another one

hey,

i'm trying to sort one column which has duplicate values by another one.

assume this example, where i want to have "status_category" sorted by "rank":

 

statusstatus categoryrank
newin progress10
first reviewin progress20
second reviewin progress30
rejectedclosed40
on holdhold50
closedclosed60
canceledclosed70

 

the problem is that one category value cannot have more than one rank value. (getting a can't sort error)
so i created another column, taking the min rank value for each category:

 

statusstatus_categoryrankmin_rank
newin progress1010
first reviewin progress2010
second reviewin progress3010
rejectedclosed4040
on holdhold5050
closedclosed6060
canceledclosed7060


using this:

 

min_rank = 
VAR currentCategory = table[status_category]
RETURN
    CALCULATE (
        MIN ( table[rank] ),
        FILTER ( ALL ( table), table[status_category] = currentCategory)
    )

so now there's only one possible rank for each category value.
however, wheb ttying the sort by option i get a new error: "This column can't be sorted by a column that is already sorted, directly or indirectly, by this column".
am i to understand that it's not possible to sort a column by another one that's calcaulated by it?

can anyone find a solution to either of the sort errors?

 

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @eshetb,


m i to understand that it's not possible to sort a column by another one that's calcaulated by it?


Yes, you should be right.

 

I think you could create the condition column in Query Editor and sort by that column.

 

For another option, you could have a try with create another table with formula like below.

 

Table 2 = {(
"in progress",1),
("closed",2),
("hold",3)}

table.PNG

Then sort category column by index column and create the relationship with the original table.

 

Here is an example:

 

for example.png

 

Hope this can make sense of you.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @eshetb,


m i to understand that it's not possible to sort a column by another one that's calcaulated by it?


Yes, you should be right.

 

I think you could create the condition column in Query Editor and sort by that column.

 

For another option, you could have a try with create another table with formula like below.

 

Table 2 = {(
"in progress",1),
("closed",2),
("hold",3)}

table.PNG

Then sort category column by index column and create the relationship with the original table.

 

Here is an example:

 

for example.png

 

Hope this can make sense of you.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.