Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Headcount for Terminated Employees

Hello,

 

I am fairly new to Power BI and I am trying to create a measure that will produce a headcount for terminated employees. I am using Pivots in Excel to check the accuracy of the measure and it's not producing the correct number.

 

Please note: Not all employees with termination dates are necessarily terminated because we people that are rehired.

This is the current measure I am using:

Terminated Employee Count = VAR currentDate = MAX( 'Calendar 2'[Date])  return CALCULATE( COUNTROWS('Emp Data' ), FILTER('Emp Data',(
    ISBLANK('Emp Data'[Job Termination Date]) = FALSE() 
&& 'Emp Data'[Job Termination Date] <= currentDate && 'Emp Data'[Job Rehire Date] < 'Emp Data'[Job Termination Date] && 'Emp Data'[Job Termination Date] >= MIN('Calendar 2'[Date])
)))

 

Any help appreciated!


Sample Data below:

 

Employee IDEmployee StatusHire DateJob Rehire DateService DateJob Termination Date
1000000Terminated01/09/2017 01/09/201706/28/2019
1000002Active08/22/2016 08/22/2016 
1000004Active04/10/2017 04/10/2017 
1000006Active10/12/2015 10/12/2012 
1000008Active08/14/2002 08/14/2002 
1000010Active05/16/2011 05/16/2011 
1000012Active04/27/2009 04/27/2008 
1000013Terminated05/31/2016 05/31/201607/05/2019
1000014Terminated04/24/2017 04/24/201712/06/2018
1000015Active01/28/2008 01/28/2008 
1000018Terminated10/20/2014 10/20/201410/19/2018
1000019Active10/16/2017 10/16/2013 
1000022Terminated08/31/2015 11/27/201706/28/2019
1000023Active11/23/2015 11/23/2015 
1000025Terminated01/17/201501/22/201801/17/201505/31/2018
1000027Active04/10/2017 04/10/2017 
1000028Terminated05/09/2005 05/09/200507/12/2019

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    We need to see:

     

    1. The full model.

    2. A CLEAR description of the procedure that is supposed to produce the correct number for any selection of attributes.

     

    Then and only then can we work on this.

     

    Best

    Darek

  • Anonymous's avatar
    Anonymous
    Not applicable

    Create an inactive relationship of your date dimension with the termination date

    then use this measure 

    Termination =
    CALCULATE (
        COUNT ( FactTable[TerminationDate] ),
        USERELATIONSHIP ( DimDate[Date], FactTable[TerminationDate] )
    ) + 0