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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
KMichael99
Frequent Visitor

RANK X with Filter

Hi, 

 

I have a table called 'Player Reference' that has the following columns: Player Name, Position Group, Maximum Speed. 

 

I am looking to rank the Maximum Speed column to provide a Positional Maximum Speed Rank. Here's my current DAX, which works correctly:

 

RANKX(
    FILTER(ALL('2023-24 Player Reference'),'2023-24 Player Reference'[Position Group] = "Half Back"),
    CALCULATE(MAX('2023-24 Player Reference'[Season MV])))
 
However, I have currently entered the text 'Half Back'. I want to dynamically change the Position Group filter based on each player chosen via a slicer. 
 
I have a seperate DAX measure called 'Position LookUp' which successfully returns each players position group. However when I replace the 'Half Back' text with the 'Position LookUp' measure, it no longer works. 
 
The other option would be to have a Position Group slicer, but I don't want to do this. 
 
Does anyone know how to fix this?
1 ACCEPTED SOLUTION
govindarajan_d
Super User
Super User

Hi @KMichael99,

 

Are you using SELECTEDVALUE to get the value of Position Group selected in the slicer?

 

And I would suggest you use a variable to capture that value before using it in RANKX measure. 

RankMeasure =
VAR __PositionGroup = SELECTEDVALUE('2023-24 Player Reference'[Position Group])
RETURN RANKX(
    FILTER(ALL('2023-24 Player Reference'),'2023-24 Player Reference'[Position Group] = __PositionGroup),
    CALCULATE(MAX('2023-24 Player Reference'[Season MV])))

 

Upvote and accept as a solution if it worked!

View solution in original post

2 REPLIES 2
KMichael99
Frequent Visitor

Brilliant, this works - thanks!

govindarajan_d
Super User
Super User

Hi @KMichael99,

 

Are you using SELECTEDVALUE to get the value of Position Group selected in the slicer?

 

And I would suggest you use a variable to capture that value before using it in RANKX measure. 

RankMeasure =
VAR __PositionGroup = SELECTEDVALUE('2023-24 Player Reference'[Position Group])
RETURN RANKX(
    FILTER(ALL('2023-24 Player Reference'),'2023-24 Player Reference'[Position Group] = __PositionGroup),
    CALCULATE(MAX('2023-24 Player Reference'[Season MV])))

 

Upvote and accept as a solution if it worked!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.