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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! 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

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
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
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.