Forum Discussion

danielgatley's avatar
danielgatley
Frequent Visitor
8 years ago
Solved

Complex Filtering with Dates

Hi All,   I'm attempting to create a point in time headcount report based on our HR data but i'm having trouble correctly filtering the data.  We have a table which is called EmployementRecord (Obv...
  • Anonymous's avatar
    Anonymous
    8 years ago

    You need a date table. Use the date field in this table as a filter in your report and then use this measure:

     

     

    Measure =
    VAR selectedDate = SELECTEDVALUE(Date[Date])
    RETURN
    CALCULATE(
        COUNTROWS(EmployementRecord),
        FILTER(EmployementRecord,
            EmployementRecord[StartDate] <= selectedDate
                && (EmployementRecord[EndDate] >= selectedDate || ISBLANK(EmployementRecord[EndDate]))
        )
    )