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
Sage2019
Frequent Visitor

RANKX not working when slicer selection is made

Hi , I am trying to create a rank measure that ranks a list of items based on their ID which is unique and incremented. However, the RANK Measure num is repeated for all items when a selection is made in the slicer. How can I fix this? 

rank measure = RANKX(ALLSELECTED(cars),calculate(SUM(cars[carID])),,ASC)

Sage2019_0-1704815278599.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Sage2019 

 

I followed your method to create the following table and measure formula, which works fine on my Power BI desktop

vjialongymsft_0-1704866867753.png

rank measure = RANKX(ALLSELECTED(cars),calculate(SUM(cars[carID])),,ASC,Dense)

vjialongymsft_1-1704866911164.pngvjialongymsft_2-1704866919845.pngvjialongymsft_3-1704866927797.png

 

 

 

If you don't want your rank measure to change with your slicer selection, you can try using the following DAX

Rank Measure1 = 
RANKX(
    ALL(cars), 
    CALCULATE(SUM(cars[carID])),
    ,
    ASC,
    DENSE
)

vjialongymsft_4-1704867185425.png

 

 

 

Best Regards,

Jayleny

 

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
Anonymous
Not applicable

Hi @Sage2019 

 

I followed your method to create the following table and measure formula, which works fine on my Power BI desktop

vjialongymsft_0-1704866867753.png

rank measure = RANKX(ALLSELECTED(cars),calculate(SUM(cars[carID])),,ASC,Dense)

vjialongymsft_1-1704866911164.pngvjialongymsft_2-1704866919845.pngvjialongymsft_3-1704866927797.png

 

 

 

If you don't want your rank measure to change with your slicer selection, you can try using the following DAX

Rank Measure1 = 
RANKX(
    ALL(cars), 
    CALCULATE(SUM(cars[carID])),
    ,
    ASC,
    DENSE
)

vjialongymsft_4-1704867185425.png

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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