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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Jos13
Helper III
Helper III

RANKX with ALL()

Hi Team,

I have 2 measures to rank categories and products based on sales.

 

Category_Rank_All_Column = RANKX(ALL(Categories[CategoryName]),[Total Sales],,DESC)
ProductRanking = RANKX(ALL(Products[ProductName]),[Total Sales],,DESC)
 
When I select categories from slicer, products(Table2) ranked correctly but categories(Table 1) not.
Rank.png
 
Can someone please tell me the reason for this ?
Thanks in advance
1 ACCEPTED SOLUTION

Hi @Jos13 ,

 

 

Have a look at this video to understand the difference between ALL() and ALLSELCTED() when used with RANKX.

 

 

https://www.youtube.com/watch?v=z2qzJVeYhTY

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

View solution in original post

6 REPLIES 6

Hi,

I had tried ALLSELECTED(). I just wanted to know why ALL() function gives different results.

 

Thanks,

Jos

Hi @Jos13 ,

 

 

Have a look at this video to understand the difference between ALL() and ALLSELCTED() when used with RANKX.

 

 

https://www.youtube.com/watch?v=z2qzJVeYhTY

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

ALL removes filter from all the columns, or a table, on the other hand ALLSELECTED only takes in account any filter that is active outside of the given visual. in easier words whatever is at the grand total is what ALLSELECTED returns.

@Jos13 , Not sure from whom this question.

 

But All means remove the filter of that particular column, take all values, All selected to take selected values

 

Refer these fore more details

https://www.sqlbi.com/articles/the-definitive-guide-to-allselected/

https://www.sqlbi.com/articles/managing-all-functions-in-dax-all-allselected-allnoblankrow-allexcept...

Ashish_Mathur
Super User
Super User

Hi,

Does this work?

=Category_Rank_All_Column = RANKX(ALLSELECTED(Categories[CategoryName]),[Total Sales],,DESC)


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors