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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
paulmacky
Regular Visitor

Ascending order in Rankx with filters

Hello. I need help to solve this problem when creating a measure with Rankx.

I want to create a ranking in ascending order that when filtering by "Liga", the ranking appears like this:

 

paulmacky_4-1667206783132.png

 

But when I write in the measure: ASC, so that it is sorted in ascending order with the filter "Liga", that order in the ranking does not occur as in the previous image:

 

paulmacky_0-1667205761612.png

 

 

I need this measure that I have created, when filtering it in "Liga" by "1ª Federación", "Argentina" or "Segunda División" to appear like this, sorting in ascending order according to the data in the "Min/Centro al área" column.

paulmacky_1-1667205761616.png

 

How can I make it appear in ascending order ordered from 1,2,3,4,5,6,7... and not appear 1 and then position 1565?

 

Thanx!!

1 ACCEPTED SOLUTION

Hi @paulmacky ,

Create a separate measure of the values you use for sorting, and then use the measure of the values in the sorted measure, using allselected(table) in the sorted measure, without the column:

Refer the below sample ,I created:

vluwangmsft_0-1667380243159.pngvluwangmsft_1-1667380254628.png

 

output result:

vluwangmsft_2-1667380278135.pngvluwangmsft_3-1667380294701.png

 

You could download my pbix file to learn more details .

 

 

 

Best Regards

Lucien

View solution in original post

5 REPLIES 5
v-luwang-msft
Community Support
Community Support

Hi @paulmacky ,

You need use allselected in your dax:

RANKX(ALLSELECTED('Table'[Column]),[Measure],,ASC,Dense)

vluwangmsft_0-1667375699848.png

 

vluwangmsft_1-1667375699780.png

 

vluwangmsft_2-1667375699834.png

 

 

 

 

Similar question refer:

https://community.powerbi.com/t5/Desktop/Dynamic-rank-with-slicer/m-p/566920  

 

 

Best Regards

Lucien

Thnx for your answer @v-luwang-msft 

I already use allselection and it doesn't work for me:

paulmacky_2-1667379132595.png

if I put dense as @amitchandak  has told me, it is close to what I need:

paulmacky_4-1667379266868.png

 

But I need it to be this way, as I indicate in red:

paulmacky_3-1667379205884.png

thnx!

Hi @paulmacky ,

Create a separate measure of the values you use for sorting, and then use the measure of the values in the sorted measure, using allselected(table) in the sorted measure, without the column:

Refer the below sample ,I created:

vluwangmsft_0-1667380243159.pngvluwangmsft_1-1667380254628.png

 

output result:

vluwangmsft_2-1667380278135.pngvluwangmsft_3-1667380294701.png

 

You could download my pbix file to learn more details .

 

 

 

Best Regards

Lucien

amitchandak
Super User
Super User

@paulmacky , Add dense as the last option in rank and try

 

RANKX(all('Table'[Column]),[Measure],,ASC,Dense)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thnx for your answer @amitchandak!

I added dense and it ordered me, but in this way:

paulmacky_0-1667378603185.png

Is there a way to make the order look like this?

paulmacky_1-1667378840967.png

 

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