Dax Rankx Within Group
I Have a Table Called Carsales with the Following Sample Data: I Already Have a Measure That Ranks All Brands by Sales: Rank = Rankx(All('Carsales'[Brand])...
I have a table called CarSales with the following sample data:
I already have a measure that ranks all Brands by sales:
Rank = RANKX(ALL('CarSales'[Brand]),[NetSales])
However, I need another measure/column **"Rank(Country)" ** which ranks the Brands within the Country group (without having to display the Country group in the table)
Thanks
1 Answer
Try the following measure:
=
VAR ThisCountry =
MIN( CarSales[Country] )
RETURN
RANKX(
FILTER( ALLSELECTED( CarSales ), 'CarSales'[Country] = ThisCountry ),
[NetSales]
)