Forum Discussion

dupreem's avatar
dupreem
Frequent Visitor
5 years ago
Solved

Headcount Over Time From Transactional Data

Hello,   I am working on building Turnover functionality and need to know headcount at a certain point in time.  The transactional data I am using looks something like this:   Employee ID  ...
  • Greg_Deckler's avatar
    Greg_Deckler
    5 years ago

    dupreem -

    Measure 14 = 
        VAR __Date = MAX([Event Date ])
        VAR __Active = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table (14)'),[Event Date ]<=__Date && [Status]="Active"),"ID",[Employee ID ]))
        VAR __Term = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table (14)'),[Event Date ]<=__Date && ([Status]="Terminated" || [Status]="Retiree" || [Status]="Dead")),"ID",[Employee ID ]))
    RETURN
        COUNTROWS(EXCEPT(__Active, __Term))