DAX Measure to rank by category and subcategory

john-paul

New Member
Joined
Nov 23, 2008
Messages
34
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have loaded a table (named "Data") into Powerpivot and would like a measure to rank by Product in each city using a ref number.
I also want this rank to stay even if I filter later.

CityProductRefRANK I want
SydneyBike1001
SydneyBike1022
SydneyBike1053
SydneyBike1124
SydneyBike1135
SydneyCar1011
SydneyCar1032
SydneyCar1043
MelbourneBike1061
MelbourneBike1082
MelbourneBike1113
MelbourneCar1071
MelbourneCar1092
MelbourneCar1103

<tbody>
</tbody>

Hope you can help.

Thanks,
John
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Given you haven’t had a response...

You want something like:

=RANKX(
ALLEXCEPT( Product, Category ),
SUM( Reference )
)
 
Last edited:
Upvote 0
Thanks gazpage.

Based on your suggestion I have used:

RANKX(
ALLEXCEPT( Data, Data[Product], Data[City]) ,
CALCULATE(SUM( [Ref]) )
)

This seems to work great.
Do you know if I can reverse the rank order so that lowest ref number is ranked first etc?

Thanks again,
John
 
Upvote 0
I have it working with the below, but each rank commences with 2 - there is no 1st rank.

Anyone able to help? Thanks.

IF(
HASONEVALUE( Data[Product] ),
RANKX(
ALLEXCEPT( Data,Data[Product],Data[City]),
[Sum_REF] , ,
ASC,Dense)
)
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top