Forum Discussion

TSI's avatar
TSI
Advocate I
7 years ago
Solved

Previous Month Value (return Text)

Hi Community,   I have a table of employee IDs and their Pay Grades each month.  I'm trying to create a new column 'Previous Month' which would show me the Pay Grade from the month before.  ...
  • parry2k's avatar
    7 years ago

    TSI try following measure

     

    Prev Pay Grade = 
    VAR __prevDate = 
    CALCULATE( 
        MAX( 'Table'[Calendar Date] ), 
        FILTER( 
            ALLEXCEPT( 'Table', 'Table'[Employee ID] ),  
            'Table'[Calendar Date] < MAX( 'Table'[Calendar Date] )
        )
    )
    RETURN
        CALCULATE( MAX( 'Table'[Pay Grade] ), ALLEXCEPT( 'Table', 'Table'[Employee ID] ), 'Table'[Calendar Date] = __prevDate )