Forum Discussion

Siddiq8686's avatar
Siddiq8686
Helper I
4 years ago
Solved

Staff Turnover - Need Help

Hello Everyone,

 

I need help in turnover measure. I have already made that and its working fine over month and years. but when i needs to calculate the overall turnover for all years it gives wrong answers. Someone also helped me in this regards but still calculation is giving wrong answer if i select all years. Let me give details about my data model.

i have three table

 

1- Monthly appended payroll  table consisting of employee numbers, Their hire dates, payroll process date,employee FTE workloads and other employee related information.

2- A table containing all separated employees consisisting of their employe numbers, their separation(end) date and their FTE workloads.

3- Calendar Tabake consisting of consective dates, month, quarters, year and other calendar table parameters.

 

I am attaching a sample aggregated information of all table for a better clarity:

 

The below table is showing monthly Employee count and Montly number of empoyee left the organization. The second table show how to calculate turnover for each month, quarters and years. The turnover formula is a bit complex.

 

DateEmployee CountEmployee Left
1/1/2016227910
2/1/2016225811
3/1/201623295
4/1/2016233713
5/1/2016250310
6/1/2016259713
7/1/2016261515
8/1/2016264614
9/1/2016268217
10/1/2016269410
11/1/201627064
12/1/201627198
1/1/2017271621
2/1/2017270821
3/1/2017267319
4/1/201726234
5/1/2017261617
6/1/201726089
7/1/2017268613
8/1/201727467
9/1/201727731
10/1/201727802
11/1/2017279320
12/1/2017281215

 

The below table show monthly calculation of turnover:

 

Please note the for every quater we will take the population of first month of every quarter as denominators. Like for Jan turnover we will take  jan employe count as denominator  and same for Feb and March. 

 

 

DateEmployee CountEmployee LeftMonthly TurnoverMonthly Turnover Formula
1/1/20162279100.44% 10/2279
2/1/20162279110.48%11/2279
3/1/2016227950.22%5/2279
4/1/20162337130.56%13/2337
5/1/20162337100.43% 
6/1/20162337130.56% 
7/1/20162615150.57% 
8/1/20162615140.54% 
9/1/20162615170.65% 
10/1/20162694100.37% 
11/1/2016269440.15% 
12/1/2016269480.30% 
1/1/20172716210.77% 
2/1/20172716210.77% 
3/1/20172716190.70% 
4/1/2017262340.15% 
5/1/20172623170.65% 
6/1/2017262390.34% 
7/1/20172686130.48% 
8/1/2017268670.26% 
9/1/2017268610.04% 
10/1/2017278020.07% 
11/1/20172780200.72% 
12/1/20172780150.54% 

 

 

For 2016 turnover we can calculate the turnover as per below given formula:

 

(sum of employee left in 2016) / Average of population of ( Jan+ April + Jul + Oct)

 

and same formula will be used for each year.

 

but if want to calculate the accumulated turnover for year 2016 and 2017, below formula will be used.

 

(sum of employee left in 2016 and 2017)  / Average of population of ( Jan 2016+ April 2016 + Jul  2016+ Oct 2016) + 

                                                                     Average of population of ( Jan 2017+ April 2017 + Jul  2017+ Oct 2017)

 

and same formula will be used if multiples years needs to be calculated.

 

Looing forward for a solution.

 

Regards,

Sid

  • Hi Siddiq8686 
    Here is the file with the solution https://www.dropbox.com/t/VXuA2561R4sF1Pul
    The data model looks like this

    The flag calculated column in the Merge_File3 table is

    Quarterly Population = 
    IF ( 
        MONTH ( Merge_File3[Payroll Process Date] ) IN { 1, 4, 7, 10 },
        TRUE 
    )

    The measures are

    Average Population = 
    VAR MonthlyPopulation =
        SUM ( Merge_File3[FTE] )
    VAR QuarterAveragePopulation =
        AVERAGEX ( 
            VALUES ('Calendar Table'[Year Quarter] ),
            CALCULATE ( 
                SUM ( Merge_File3[FTE] ),
                Merge_File3[Quarterly Population] = TRUE
            )
        )
    VAR Result = 
        IF (
            HASONEVALUE ( 'Calendar Table'[Year Month] ),
            MonthlyPopulation ,
            QuarterAveragePopulation 
        )
    RETURN
        Result
    Employee Left = COUNTROWS ( Separation_Data4 )
    Employee Left RT = 
    VAR LastMonthInFilter =
        MAX ('Calendar Table'[Year Month Number] )
    RETURN
        CALCULATE ( 
            [Employee Left],
            REMOVEFILTERS ('Calendar Table' ),
            'Calendar Table'[Year Month Number] <= LastMonthInFilter
        )
    % Turnover = 
    DIVIDE (
        [Employee Left],
        SUMX ( 
            VALUES ('Calendar Table'[Year] ),
            [Average Population]
        )
    )
    New Hires = COUNTROWS ( Hireing_Data )
    Hires RT = 
    VAR LastMonthInFilter = 
        MAX ( 'Calendar Table'[Year Month Number] )
    VAR Result =
        CALCULATE ( 
            [New Hires],
            REMOVEFILTERS ( 'Calendar Table' ),
            'Calendar Table'[Year Month Number] <= LastMonthInFilter
        )
    RETURN
        Result
    Total Population = [Hires RT] - [Employee Left RT]

    Your report looks like this

    Please let me know if you still have any doupt.

11 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Siddiq8686 
    Here is the file with the solution https://www.dropbox.com/t/VXuA2561R4sF1Pul
    The data model looks like this

    The flag calculated column in the Merge_File3 table is

    Quarterly Population = 
    IF ( 
        MONTH ( Merge_File3[Payroll Process Date] ) IN { 1, 4, 7, 10 },
        TRUE 
    )

    The measures are

    Average Population = 
    VAR MonthlyPopulation =
        SUM ( Merge_File3[FTE] )
    VAR QuarterAveragePopulation =
        AVERAGEX ( 
            VALUES ('Calendar Table'[Year Quarter] ),
            CALCULATE ( 
                SUM ( Merge_File3[FTE] ),
                Merge_File3[Quarterly Population] = TRUE
            )
        )
    VAR Result = 
        IF (
            HASONEVALUE ( 'Calendar Table'[Year Month] ),
            MonthlyPopulation ,
            QuarterAveragePopulation 
        )
    RETURN
        Result
    Employee Left = COUNTROWS ( Separation_Data4 )
    Employee Left RT = 
    VAR LastMonthInFilter =
        MAX ('Calendar Table'[Year Month Number] )
    RETURN
        CALCULATE ( 
            [Employee Left],
            REMOVEFILTERS ('Calendar Table' ),
            'Calendar Table'[Year Month Number] <= LastMonthInFilter
        )
    % Turnover = 
    DIVIDE (
        [Employee Left],
        SUMX ( 
            VALUES ('Calendar Table'[Year] ),
            [Average Population]
        )
    )
    New Hires = COUNTROWS ( Hireing_Data )
    Hires RT = 
    VAR LastMonthInFilter = 
        MAX ( 'Calendar Table'[Year Month Number] )
    VAR Result =
        CALCULATE ( 
            [New Hires],
            REMOVEFILTERS ( 'Calendar Table' ),
            'Calendar Table'[Year Month Number] <= LastMonthInFilter
        )
    RETURN
        Result
    Total Population = [Hires RT] - [Employee Left RT]

    Your report looks like this

    Please let me know if you still have any doupt.

    • Siddiq8686's avatar
      Siddiq8686
      Helper I

      Hey Tamerj,

       

      Thanks for your solution. This is working fine now.

       

      Apologies for delayed response i was out of for some personal work.

       

      Thanks again.

       

      Regards,

      Sid

  • Siddiq8686 , for denominator, try a measure like

    AverageX(values('Date'[Month Year]), calculate(firstnonblankvalue('Date'[Month Year], calculate(Average(Table[Employee Count]))), allexcept('Date'[Qtr Year])))

    • Siddiq8686's avatar
      Siddiq8686
      Helper I

      amitchandak , i tried but its giving wrong answer and why this measure is not gettin filtered with other slicer. Can i share my Pbix file for clarity??

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Siddiq8686 
    I think now is ok. Please chec and confirm https://www.dropbox.com/t/voAOBiOMvkXI5J2p

     

    Average Population1 = 
    VAR MonthlyPopulation =
        SUM ( Payroll_Merge_File[FTE] )
    VAR QuarterAveragePopulation =
        AVERAGEX ( 
            VALUES ('Date'[Year Quarter] ),
            CALCULATE (
                AVERAGE ( Payroll_Merge_File[Quarterly Population] ),
                USERELATIONSHIP ( 'Date'[Year Quarter], Payroll_Merge_File[Year Quarter] )
            )
        )
    VAR Result = 
        IF (
            HASONEVALUE ( 'Date'[Year Month] ),
            MonthlyPopulation ,
            QuarterAveragePopulation 
        )
    RETURN
        Result 

     

  • Hey Tamerj,

     

    The measure is workin file over year slicer but when i needs to slice the data over employees Division, Employe Gender and Ethinicty wise. result is constant for all slicers. For example, if i used gender in slicer, and when i select FEMALE from gender then formuls should take Sepatration of Female and denominators of female popultion. but right now the formula is taking overall population in denominator for all slicer. I think this is because we are taking employe population from quarter year colums and in that column we have a constant value of monthly population.

     

    Can i make it dynamic.

     

    Regards,

    Sid

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Siddiq8686 ,

      You can refer the following links to get the staff turnover:

      Staff Turnover Calculation In Power BI Using DAX – HR Insights

      Calculating Turnover Rate in DAX ( But: Using Average Employed Per Day )

      Leavers =
      VAR MaxDate = Max ( Date_Table[Date] )
      VAR MinDate = Min ( Date_Table[Date] )
      RETURN
      0 +
      CALCULATE (
      COUNTROWS(Raw_Data),
      Raw_Data[To] <= MaxDate,
      Raw_Data[To] >= MinDate,
      All(Date_Table)
      )
       
      Headcount =
      VAR MaxDate = Max ( Date_Table[Date] )
      VAR MinDate = Min ( Date_Table[Date] )
      RETURN
      0 +
      CALCULATE (
      COUNTROWS(Raw_Data),
      Raw_Data[From] <= MaxDate,
      Raw_Data[To] >= MinDate || ISBLANK(Raw_Data[To]),
      All(Date_Table)
      )
       
      Av_Turnver =
      VAR MaxDate = Max(Date_Table[Date])
      VAR MinDate = Min(Date_Table[Date])
      VAR DayCount = 1 + (MaxDate - MinDate)
      RETURN
      DIVIDE (
      [Leavers] * DayCount,
      SUMX(Date_Table, [Headcount]),
      0
      )

      Calculating Employee Turnover in DAX- In and Out

      If the above ones can't help you, you can refer the following thread to upload your pbix file in your post.

      How to upload PBI in Community

      Best Regards

      • Siddiq8686's avatar
        Siddiq8686
        Helper I

        Anonymous 

        Thanks for your reply. I tried this but this is not helping me out. for denominator i need to take average of first month of all quarters means (  population of Jan+April+Jul+Oct)/4.

         

        I am going to share my pbix file shortly.

  • tamerj1 ,

    Thanks for your time and response,

     

    Let me check the calculations i will inform you if any help is required.

     

    Thanks,

    Sid

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Siddiq8686 ,

      Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.

      Any comment or problem, please feel free to let us know.

      Best Regards