Forum Discussion

hasier's avatar
hasier
Frequent Visitor
3 years ago
Solved

Using RANKX to order by date and more criterias

Hi,   I am trying to order one table by date using RankX() but taking into account that when the value is the same on column "Name" the output should be the same and that I only want to order when ...
  • Jihwan_Kim's avatar
    3 years ago

    Hi,

    Please check the below picture and the attached pbix file.

     

     

     

    Rank CC =
    VAR _newtable =
        FILTER ( Data, Data[Task] = "PUBLISH" )
    VAR _rankcolumn =
        SUMMARIZE (
            ADDCOLUMNS (
                _newtable,
                "@rank", COUNTROWS ( FILTER ( _newtable, Data[Date] <= EARLIER ( Data[Date] ) ) )
            ),
            Data[Name],
            [@rank]
        )
    RETURN
        MAXX ( FILTER ( _rankcolumn, Data[Name] = EARLIER ( Data[Name] ) ), [@rank] )