Forum Discussion

vin26's avatar
vin26
Resolver I
5 years ago
Solved

Getting wrong Ranking on date filter

Hello,   I am unable to get the proper ranking on a simple dataset. I have Date, Country and Projection values, please find below screenshot:   Please help me get the dynamic ranking based ...
  • v-xuding-msft's avatar
    v-xuding-msft
    5 years ago

    Hi vin26 ,

     

    Sorry for late back.

     

    Please try to create a date table and use its column as slicer. I modified the formula, please try again.

    Date = CALENDAR(MIN(country_projection[date]),MAX(country_projection[date]))
    Measure 2 =
    RANKX (
        ALLSELECTED ( country_projection ),
        CALCULATE (
            SUM ( country_projection[projection] ),
            FILTER (
                ALLEXCEPT ( country_projection, country_projection[country] ),
                country_projection[date] >= MIN ( 'Date'[Date] )
                    && country_projection[date] <= MAX ( 'Date'[Date] )
            )
        ),
        ,
        DESC,
        DENSE
    )
    

     

     

     

  • vin26's avatar
    vin26
    5 years ago

    Hi v-xuding-msft Thanks a lot for the solution, this works fine. Excellent!

     

    I have also got another logic which also works for my requirement:

     

    SumCountry = SUM(country_projection[projection])
    
    RankCountry = IF(
        ISFILTERED(country_projection[date]),
            RANKX(
                ALLSELECTED(country_projection[country]),[SumCountry],,DESC,Skip
                )
        )