Forum Discussion

Pbiuserr's avatar
Pbiuserr
Post Prodigy
4 years ago
Solved

Measure with dates

Hello. Trying to calculate headcount. Basically it means I am trying to count the rows for the period if the hiredate is less than the date and the termdate is greater than date OR if the termdate is...
  • Pbiuserr's avatar
    Pbiuserr
    4 years ago

    This solved my problem:

    Headcount =

    CALCULATE (
        COUNTROWS ( dataset ),
        FILTER ( VALUES ( dataset[start] ), dataset[start] <= MAX ( 'Calendar'[Date] ) ),
        FILTER (
            VALUES ( dataset[term] ),
            OR ( dataset[term] >= MIN ( 'Calendar'[Date] )ISBLANK ( dataset[term] ) )
        )
    )