Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Help needed with filters

Hello,   For background - the hire date field has no relationship with the date table.   I need to count employees that were hired in the past year based on the date selected - but I need to remov...
  • johnt75's avatar
    johnt75
    4 years ago

    Perhaps the FILTER is being called before the REMOVEFILTERS is applied. Try

    TTM Hires =
    VAR selecteddate =
        MAX ( 'Date'[Date] )
    VAR enddate =
        DATEADD ( LASTDATE ( 'Date'[Date] ), -1, YEAR )
    RETURN
        CALCULATE (
            DISTINCTCOUNT ( 'Monthly Workforce'[FDS ID] ),
            REMOVEFILTERS ( 'Date' ),
            'Monthly Workforce'[Hire Date] <= selecteddate
                && 'Monthly Workforce'[Hire Date] > enddate
        )