Forum Discussion

kasife's avatar
kasife
Helper V
3 years ago
Solved

Ranking

Hi guys,
I've been trying different ways to create a ranking, but without success

I would like to create an index measure by city and project, sorted by date.
Someone could help me ?

https://ufile.io/py9vncsk


This is the result I would like to get

 

 

 

 

  • Hi kasife ,

    Based on the linked pbix, you used the latest release date by project to get the index but the dates on your screenshot do not match with your pbix.

    That aside, if you want to use the latest date, create a calculated column for that first and then use that calculated column in RANKX.

    Latest Release Date by Project = 
    CALCULATE ( MAX ( Tabela[Realese Date] ), ALLEXCEPT ( Tabela, Tabela[Project] ) )
    Index = 
    RANKX (
        FILTER ( Tabela, Tabela[City] = EARLIER ( Tabela[City] ) ),
        Tabela[Latest Release Date by Project],
        ,
        ASC,
        DENSE
    )
    

     

4 Replies

  • Hi kasife ,

     

    Try this as a calculated column

    rank =
    RANKX (
        FILTER ( 'DataTable', 'DataTable'[city] = EARLIER ( 'DataTable'[city] ) ),
        'DataTable'[Date],
        ,
        ASC,
        DENSE
    )
    

     

    • kasife's avatar
      kasife
      Helper V

      danextian 
      The ranking is still not giving the result I would like.

      Below I put what it is returning me and the result I would like to get

       

      • danextian's avatar
        danextian
        Super User

        Hi kasife ,

        Based on the linked pbix, you used the latest release date by project to get the index but the dates on your screenshot do not match with your pbix.

        That aside, if you want to use the latest date, create a calculated column for that first and then use that calculated column in RANKX.

        Latest Release Date by Project = 
        CALCULATE ( MAX ( Tabela[Realese Date] ), ALLEXCEPT ( Tabela, Tabela[Project] ) )
        Index = 
        RANKX (
            FILTER ( Tabela, Tabela[City] = EARLIER ( Tabela[City] ) ),
            Tabela[Latest Release Date by Project],
            ,
            ASC,
            DENSE
        )