Forum Discussion

lnayak's avatar
lnayak
Frequent Visitor
4 years ago
Solved

Use a measure 'Active Unique Headcount' using SUMX function.

HeadCount = VAR selectedDate= MAX('Calendar'[Date] RETURN SUMX('EDE'[Worker #], VAR WorkerStartDate = ('EDE'[MinStartDate]) VAR WorkerEndDate = ('EDE'[MaxEndDate]) RETURN IF ( WorkerStartDate<...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi lnayak 

    Based on your formula, I created a simple sample.

    Original data :

    Then use the formula you provided . I modified it to return the value 1 or 0 .

    HeadCount =
    VAR selectedDate=MAX('Calendar'[Date])
    VAR _WorkerStartDate= SELECTEDVALUE(EDE[MinStartDate])
    VAR _WorkerEndDate = SELECTEDVALUE(EDE[MaxEndDate])
    RETURN IF ( _WorkerStartDate<=selectedDate && _WorkerEndDate>=selectedDate,1,0)

    Then create a measure to count the total value .

    count = SUMX('EDE',[HeadCount])

    The final result is as shown :

    I have attached my pbix file , you can refer to it .

     

    Best Regard

    Community Support Team _ Ailsa Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.