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
olukeo
New Member

Find ranking for one specific product in RANKX

Hi PBI community and experts!

 

I am using RANKX in a measure and would like to return a specific product ranking and ran into some problems. 

 

For example, for the below product/sales list, I would like to know the Sales ranking of product G.

 

Product

Sales

A

47.11261

B

490.3483

C

162.2565

D

981.8481

E

427.8431

F

994.7399

G

504.8072

H

850.7163

 

By creating a static “Product ranking” measure, it works fine to show Product G’s ranking (i.e. “4”) using a Multi-row card plus basic filtering (select only "G").

 

Product ranking = RANKX(ALL(Sheet1), CALCULATE(SUM((Sheet1[Sales]))))

 

Product SalesProduct Ranking
A47.112618
B490.34835
C162.25657
D981.84812
E427.84316
F994.73991
G504.80724
H850.71633

 

In a dynamic situation with a slicer to select “Product”, the “Product ranking” measure is then amended as below:

 

Product ranking = RANKX(ALLSELECTED(Sheet1), CALCULATE(SUM((Sheet1[Sales]))))

 

Slicer selecting only A,E,G and H

Product SalesProduct Ranking
A47.112614
E427.84313
G504.80722
H850.71631

 

However, this time the Product G’s ranking using a Multi-row card plus basic filtering will always return “1” instead of “2”, since the slicer selection flows into the “Product ranking” measure via ALLSELECTED.

 

How can this be fixed or is there a better way to return the ranking number of a specific product?

 

Many thanks for your help in advance.

 

Bests regards.

1 REPLY 1
lbendlin
Super User
Super User

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.