Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

DAX Ranking data based on multiple categories



I have a table of data that has macroeconomic data on countries over a period of years. I am trying to assign a rank to each country based on their value, while still taking into account the Year, Indicator, and Grouping columns AND skipping over any blank Values. The end result would read like the "Rank" column in the below sample picture. I've tried adapting lots of different forum posts to my problem but nothing has been successful and I just cannot seem to figure it out..I know it should be possible with some combination of the Rankx(Filter(All( functions.



To me the logic would be something like: If the Value is not blank then Rank the country's value against all other nonblank country values within the same Indicator, Grouping, and Year. 


I would also probably need to use RANKX function as I need a way to switch from ASC to DESC ranking depending on the Indicator, as for some indicators the lower value the better while others a higher value the better. 


Here is a link to the file:


I really appreciate any help, thanks in advance.



Community Support
Community Support

@rajivraina ,


You may refer to the measure below.

Rank Measure =
        VALUES ( 'Country Mapping File'[ALL Country] ),
        ALLSELECTED ( 'Country Mapping File'[ALL Country] )
    CALCULATE ( SUM ( 'TE Data'[Value 4 Column] ) ),
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors