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
OECvargoj
Frequent Visitor

Rankx and Slicers

Hello everyone,

 

I am in need of some assistance regarding the rankx function. I have my rankx setup and working properly, however what I'm looking to do is keep the overall rank when slicing my data. In my example, I rank stores 1-54 based on Total Sales. What I want to do from there is slice by region, for example say the North Region. I slice by North Region and the rankings are then reordered based on only the stores in that region. If the North region contained overall store ranks of 6, 15 and 54 how would I go about getting 6, 15 and 54 to display instead of 1, 2, 3,4,5,6?

 

Rankx to rank all stores

National Sales Rank DAX.png

 

All stores being displayed in rank order

Apple Dealer North 6th Overall.png

Stores in the North Region - I am looking for "Apple Dealership" to display with a rank of 6 instead of 1.

Apple Dealer North 1st in Region.png

3 REPLIES 3
Greg_Deckler
Super User
Super User

Are your regions in another table? Can you post sample data, have just been doing a bunch of work with RANKX.

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks for the quick reply Greg! Everything is in the same table. My original setup utilized seperate tables however I could not get the rankx function to work properly when pulling in items from more than one table. 

 

Sample Data:

DateDealer NameOrdersSalesPMA ReimbursementMargin Pre ReimbursementMargin Post ReimburesementNon-Program ConversionsConversionsOpportunitiesOEM SalesNon-ProgramOEM ProgramPromotionsPart Group NumberPart GroupPMA Program NumberPMA ProgramPart NumberAMOEMSalvagedRemanLKQRegionDistrictDealer CodeStateCity
43100American Dealership8$1,979.00$158.32$277.06$435.38$39.5816432464$336.43$1,187.40$692.65$98.9513Suspention6Reward PMA37994184873929624674North1481657MEPortland
42948Liberty Dealership23$309.00$24.72$33.99$58.71$6.18192266$117.42$185.40$108.15$15.458Engine6Reward PMA177342008032278South1125364FLJacksonville
42835Eagle Dealership12$1,214.00$97.12$230.66$327.78$12.148381089$376.34$728.40$424.90$60.7011Ignition5Impact PMA4078281732713110933East1398618NCCharlotte
42899Airport Dealership23$403.00$32.24$68.51$100.75$12.09266351$137.02$241.80$141.05$20.153Belts & Cooling3Country PMA56784263105423511West1239303CALos Angeles
42876Jim's Dealership9$1,210.00$96.80$242.00$338.80$24.208951074$314.60$726.00$423.50$60.502Air & Fuel Delivery4Royal PMA1107180632212910732South West1483921NMSanta Fe
43042Lichty Dealership6$660.00$52.80$105.60$158.40$6.60429528$231.00$396.00$231.00$33.0012Steering2City PMA32764396158635316South East1830173SCCharelston
42821Garlow Dealership15$895.00$71.60$107.40$179.00$8.95635934$259.55$537.00$313.25$44.7515Transfer Case5Impact PMA524147012801129328North West1821287WASeattle
42887Apple Dealership23$1,043.00$83.44$312.90$396.34$10.438451183$198.17$625.80$365.05$52.156Driveline & Axels2City PMA2337988735514211835North2952495MASalem

Hmm, very strange. I recreated this and it seems to work perfectly. See attached PBIX, Table9 Page 2. There is some other junk you don't want, this is my working PBIX.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.