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

RANX X delivering same rank to multiple values

I've used RANKX before but with filter. I can not get it to work without Filter. My goal is to simply Rank all customers by Sales. 

 

Fields used:

Fact_Sales[Sales_Sum]       Measure that Sums Sales

Dim_Customer                   Table (distinct row per Customer linked to Sales by CustomerKey)

 

Measure

CustomerRank_Sales = RANKX( ALLSELECTED( DIM_Customer ) ,
CALCULATE( SUMX(Fact_Sales, FACT_Sales[Sales_Sum] ) ) , , DESC , Dense )
 
Filters:
Filtered to reduce rows (filter by SalesTerritory in Filters Pane
Filtered for Top 15 CustomerRank_Sales. I am hoping that even if pulling in Territory etc. that the Top 15 Rank will be 15 despite that a Territory rank may start with a Customer ranked 30 over all.
 
Please don't tell me I have to make a Measure for each Territory and use RANKX with Filter! Please (too many Territories)
Result:
 

 

Please and Thank you and I give KUDOS and mark as SOLVED!

ScubaBob_0-1603986491247.png

 

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think you want your measure to not be affected by other columns. Please try to use ALL function and ALLEXCEPT function.

 

CustomerRank_Sales = RANKX(ALL('Table'),CALCULATE(SUM('Table'[Sales_Sum]),ALLEXCEPT('Table','Table'[Customer])))

 

 

There is a blog you can refer to:

 

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

 

 

Best Regards,

Stephen Tao

 

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

Ashish_Mathur
Super User
Super User

Hi,

I am not clear about your question.  Share the link of the PBI file and show the result there clearly.


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

@Ashish_Mathur ,

 

Sorry, I did not see that the Rank numbers disappeared in the above example. I edited it to show the rank number.

I described the data fully. I can't share the file. The Cube has maybe 15 tables including a calendar table. The cube works perfect.

Hopefully that is all you need. 

Thank you much!

 

 

 

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.