wycliff
wycliff

Reputation: 1

DAX RANKX Within Group

I have a table called CarSales with the following sample data:

1

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

Upvotes: 0

Views: 3657

Answers (1)

Jos Woolley
Jos Woolley

Reputation: 9062

Try the following measure:

=
VAR ThisCountry =
    MIN( CarSales[Country] )
RETURN
    RANKX(
        FILTER( ALLSELECTED( CarSales ), 'CarSales'[Country] = ThisCountry ),
        [NetSales]
    )

Upvotes: 1

Related Questions