Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

% Staff Turnover Measure

Hi there,

 

I am still fairly new to Power BI. Whilst I am now more familar with how to calculate Monthly Staff Turnover and YTD Staff Turnover. I am not sure how to work out the number of employees at the beginning of the month and end of the month to be able to input these values into the staff turnover formula.

 

I have two tables:

1. Current Staff Data

2. Leaver Staff Data 

 

Both tables are the exact same structure (leaver data is simply a cut and paste of the employee entry in the current staff data) - one represents leavers and one represents currently hired staff. The only difference is the Leavers Table contains an Actual Post End Date column.

 

The data looks like this (with all identifying information removed):

1. Current Staff Data

Employee NoDomainTeamCurrent Post End Date 
11004439SASStrategy, Architecture and Support/Strategy and Architecture/Business Analysis  
2153456PASMProduct and Service Mgmt/Service Operations/Deskside Support  
9402751ENGEngineering/Infrastructure/Datacentres  
10095216PASMProduct and Service Mgmt/Service Operations/Deskside Support01/03/2022 
11182695PASMProduct and Service Mgmt/Service Operations/Support Centre16/07/2022 
10283718ENGEngineering/Platforms and Innovation/CRM29/07/2022 
10990597PASMProduct and Service Mgmt/Service Operations/Support Centre31/08/2022 
10227025ENGEngineering/Infrastructure/Datacentres  
10798077RITResearch IT/Research Lifecycle Programme  

 

2. Leaver Staff Data

Employee NoDomainTeamCurrent Post End DateActual Post End Date
10318971ODITIT Supplier Management01/01/202201/01/2022
10765145ODITProject Management/PMO03/01/202203/01/2022
5189438TIONetworks and Security/Networks16/01/202216/01/2022
10615129ODITMarketing and Comms26/01/202226/01/2022
9248303SIAMService Delivery/Service Delivery Management03/02/202203/02/2022
7473469ODITProject Management/PMO16/03/202216/03/2022
9840817SDATesting31/03/202231/03/2022
10864015SIAMService Operations/Deskside Support31/03/202231/03/2022
10525288SDATesting05/04/202205/04/2022

 

Any advice would be greatly appreciated! Thank you.

  • Hi Anonymous ,

     

    There seems to be something wrong with the data you gave.

     

    If you want to count the number of employees from the beginning to the end of the month, you can try the following formula.

    last_mount =
    VAR selectedDate =
        LASTDATE ( 'Date'[Date] )
    VAR selectedDateMonthsBefore =
        NEXTDAY ( DATEADD ( selectedDate, -1, MONTH ) )
    RETURN
        SUMX (
            'Employees',
            IF (
                [End Date] >= selectedDateMonthsBefore
                    && [End Date] <= selectedDate,
                1,
                0
            )
        )

     

    related link


    If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


    Best Regards,
    Henry


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

2 Replies

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi Anonymous ,

     

    There seems to be something wrong with the data you gave.

     

    If you want to count the number of employees from the beginning to the end of the month, you can try the following formula.

    last_mount =
    VAR selectedDate =
        LASTDATE ( 'Date'[Date] )
    VAR selectedDateMonthsBefore =
        NEXTDAY ( DATEADD ( selectedDate, -1, MONTH ) )
    RETURN
        SUMX (
            'Employees',
            IF (
                [End Date] >= selectedDateMonthsBefore
                    && [End Date] <= selectedDate,
                1,
                0
            )
        )

     

    related link


    If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


    Best Regards,
    Henry


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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you! This worked.