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]),[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

1 Answer

Try the following measure:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest