cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
BI_Nooby
Frequent Visitor

RANKX and ALLSELECT, trying to rank customers within catagories (with slicers and visual filter)

Hi,

 

I'm trying to rank my customers (by sum of sales) within catagories. 
In addition, only showing Top 3 and being able to slice on customer.

 

My datamodel

BI_Nooby_0-1686570541153.png

My DAX measures:

_SUM = SUMX(Facts, Facts[FACT_VALUES])
 
Ranking =IF(
ISINSCOPE(Customer[CUSTOMER]),
(RANKX (ALLSELECTED(Customer[CUSTOMER]), CALCULATE(SUM(Facts[FACT_VALUES])),,desc,Dense)))

And my result (which is incorrect)
BI_Nooby_1-1686570717008.png
and another example
BI_Nooby_2-1686570842214.png

 

I've read several articles, where it suggests the DAX I've written.
But obviously, the ranking isn't going well.

 

What am I doing wrong?

 

2 REPLIES 2
Mahesh0016
Solution Sage
Solution Sage

@BI_Nooby I hope this helps you!THANK YOU!!

 

RANK =
CALCULATE(
    RANKX ( ALLSELECTED ( 'Table'[Customer ID] ), [Total Sale],, DESC, DENSE )
)

Mahesh0016_0-1686574638808.png

 

Sorry that didn't help. Mind telling me why you think wrapping the RANKX inside a CALCULATE would be the solution?

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors