Forum Discussion

AvPowerBI's avatar
AvPowerBI
Icon for Post Patron rankPost Patron
4 years ago
Solved

Rank Dates

Hi,   I want to do a Rank function which is based on the columns TableName, Group and DateTime So for the latest DateTime for each TableName that is in the Group I want that to be ranked as 1 e.g...
  • SpartaBI's avatar
    4 years ago

     

    AvPowerBI 

    Rank = 
    VAR _name = 'Table'[TableName]
    VAR _group = 'Table'[Group]
    VAR _result = 
    RANKX(
        FILTER(
            ALL('Table'),
            'Table'[TableName] = _name
             && 'Table'[Group] = _group
        ),
        'Table'[DateTime],
        ,
        DESC
    )
    RETURN
        _result