Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Index depending on date, category and first case

Hi everybody,   I'm still new in this and need help to index or rank my table.   Here is the situation, I have a table with a date, country, and cases. I want to index/rank by date by country but...
  • Mariusz's avatar
    6 years ago

    Hi Anonymous 

     

    try this 

    Column = 
    VAR __filterCountry = ALLEXCEPT( 'Table', 'Table'[Country] )
    VAR __firstDate =
        CALCULATE(
            MIN( 'Table'[Date] ),
            __filterCountry,
            'Table'[Cases] > 0
        )
    VAR __tbl = 
        CALCULATETABLE(
            'Table',
            __filterCountry,
            'Table'[Date] >= __firstDate
        )
    RETURN 
    IF( 
        'Table'[Date] >= __firstDate, 
        RANKX(
            __tbl,
            'Table'[Date],,
            ASC,
            Dense
        )
    )

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn