Forum Discussion

bwarner87's avatar
bwarner87
Advocate I
4 years ago
Solved

Calculated Table containing Filter Expression with date lookup

DAX Experts,   I’m hoping you can help. I got to a good point for calculating time in position in my Master Employee Table for each employee row but then, some new requirements came in and I’m stuc...
  • AlexisOlson's avatar
    4 years ago

    How about this?

     

    Time in Position =
    VAR DatesJXC =
        CALCULATETABLE (
            VALUES ( 'Salary History (All)'[Appointment Start Date] ),
            'Salary History (All)'[Salary Reason Code] IN { "JRC", "JAC" }
        )
    RETURN
        DATEDIFF (
            CALCULATE (
                MAX ( 'Salary History (All)'[Appointment Start Date] ),
                NOT ( 'Salary History (All)'[Appointment Start Date] IN DatesJXC )
            ),
            TODAY (),
            MONTH
        ) / 12

     

    This gives 6.92 but you can add 1 to the DATEDIFF before dividing by 12 to get 7.00.