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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

RANKX additional context

Hi Friends,

 

I have issue with RANKX 

 

1.png

When I have table only with Customer Name and RANKX formula everything works well.

 

2.png

 

But when i'm adding addinional context (Company Type, Domain ) RANKX does not work properly.

3.png

 

Could you please help?

 

Thanks in advance!

 

Regards,

Oleh

 

1 ACCEPTED SOLUTION

Hi  @Anonymous

 

I made some changes to your model.


1. Changed the relationship direction and type 

2. Rank Measure - it needs to be ALL( Account[Account] ) not ALL(  Revenue [Account] )

3. In your visuals use the fields from the Account table, not from Revenue 

 

Please see the attached file.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

Refer

https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

If you are trying to rank over the columns you are adding then you will need to include these columns in the first argument of rankx  ALL( column1, column2, column3 ).

 

If you are looking for a different outcome then please can you provide a data sample and an outcome expected.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

Anonymous
Not applicable

@Mariusz,

 

You can find Data Sample and expected outcome via this  Link  

 

 

4.png

Thanks for your help!

Regards,

Oleh

Hi  @Anonymous

 

I made some changes to your model.


1. Changed the relationship direction and type 

2. Rank Measure - it needs to be ALL( Account[Account] ) not ALL(  Revenue [Account] )

3. In your visuals use the fields from the Account table, not from Revenue 

 

Please see the attached file.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

Anonymous
Not applicable

Hi @Mariusz ,

 

Unfortynately rank equals "1" for all Accounts:(

 

Hi @Anonymous 

 

Sorry I missed that, please see the attached with a fix to the Rank Measure.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Anonymous
Not applicable

@Mariusz It works!

Thank you - you're a magician)

Have a nice day!

Regards,

Oleh

Anonymous
Not applicable

7.png

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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