Forum Discussion

ggzmorsh's avatar
ggzmorsh
Helper II
5 years ago
Solved

Calculate MAX text value

I have Table1 which contains 4 occurrences of the same ID happening in different date/times and remarks. What i need to do is to return the most recent remarks which is "A". I tried using max value ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi ggzmorsh ,

    You can create a measure as below:

     

    Latest remark = 
    VAR _maxdate =
        CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
    RETURN
        CALCULATE (
            MAX ( 'Table'[Remarks] ),
            FILTER (
                'Table',
                'Table'[ID] = MAX ( 'Table'[ID] )
                    && 'Table'[Date] = _maxdate
            )
        )

     

    Best Regards