Forum Discussion

SofG's avatar
SofG
Frequent Visitor
6 years ago

Head count formula not working

Hi,

 

I wish to calcute number of contracts and FTE's. My employee data set looks like this:

 

Person ID                  Cost Center            Role                 Employment start date         Employment end date               Work degree             PersonCCRoleWD               PersonCCRole

 

I have a separate calendar table which I try to connect with the employee data thorugh formulas.

 

I started of by using the forumlas below because I only want to calculate the rows when people have actually changed role/cost center/work degree. (One employee can be counted multiple times in our system, and I only want to count them once with the help of this "code").

 

Correct Start date = CALCULATE(MIN('People Data'[Employment start date]);

ALLEXCEPT( 'People Data'; 'People Data'[Person CC Role WD]))

 

Correct end date = CALCULATE(MAX('People Data'[End date modified]);

ALLEXCEPT( 'People Data'; 'People Data'[Person CC Role WD]))

 

To count number of contracts, I used this formula:

 

Contracts =

CALCULATE (

DISTINCTCOUNT ('People Data'[Person CC Role]);

FILTER (

'People Data';

'People Data'[Correct Start date]<=MAX('Dynamic Calendar Table'[Date])

&& 'People Data'[Correct end date]>MAX( ('Dynamic Calendar Table'[Date])

)))

 

Some how I do not get the right number of contracts with the above formulas.

 

When i try to calculate FTE's I use this formula:

 

FTE =

CALCULATE(

SUMX (DISTINCT('People Data'[Person CC Role]);[Max Work degree alt])

;FILTER (

'People Data';

'People Data'[Correct Start date]<=MAX('Dynamic Calendar Table'[Date])

&& 'People Data'[Correct end date]>MAX( ('Dynamic Calendar Table'[Date] )

)))

 

Where Max work degree is based on:

Max Work degree alt = CALCULATE ( [Max Work Degree];

FILTER('People Data';

Max('People Data'[Employment start date])))

 

 

max work degree = calculate(max('People Data'[Work Degree]);allexcept('People Data';'People Data'[Person CC Role]))

 

 

 I hope this was somewhat clear.. Can anyone help me? MY PBI file is depening on the head count to be correct. Thanks in advance!

 

Kinds regards

9 Replies

  • Hi,

     

    your criterium in the FILTER formula is not quite correct. You have

     

    People Data'[Correct end date] > MAX( ('Dynamic Calendar Table'[Date])

    and it should be 

     

    People Data'[Correct end date] >= MIN( ('Dynamic Calendar Table'[Date])

    say, If your date filter is 01.01.2017 - 31.12.2017 and someone quits on 30.06, this person won't be included in your measure.

    • SofG's avatar
      SofG
      Frequent Visitor

      Thank you Vik0810!

       

      That helped! However the number is still way too low. For FY19 Q2 it says about 800 people less than my filtering in Excel.

       

      When I filter further down to month level, the number decrease even more. As an example: My excel say around 4000 for Q2, PBI says 3000 for q2 and 1000 for June. I would like for FY2019 and all quarters to calcuate the last date in that period. It should not differ that much from month to month... We are constantly around 4000 employees. Do you have any idea why it still differs so much?

       

      Thanks!

      • vik0810's avatar
        vik0810
        Icon for Resolver V rankResolver V

        I'm not sure, but I think you are not considering people with empty employment end date, so may be your criterium should be

         

        OR(People Data'[Correct end date] >= MIN( ('Dynamic Calendar Table'[Date]), ISBLANK(People Data'[Correct end date]))