Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Starters and leavers from monthly extract

Hi,

I currently record the changes in headcount for a large team, with data coming from a monthly extract. Currently I count this simply by counting no. of unique IDs per month.

 

I now want to be able to find out what is causing the the changes from month to month. E.g. if I can see that between Jan and Feb count goes from 560 to 550, what makes that up - is it 10 leavers, or 15 new starters and 25 leavers for example?

 

I know in theory this should be easy, as the data shows when a unique ID first starts/ ends. However so far, I have only been able to create a matrix which kind of shows what I am looking for, looks awful though.

 

 

Example of data set used:

 

Employee ID  ,  Extract month  ,  Boring employee info stuff

1312313           Jan                      XXXXXXXXXXX 
1231231           Jan                      XXXXXXXXXXX
2534556           Jan                      XXXXXXXXXXX
4356546           Jan                      XXXXXXXXXXX

2534556           Feb                      XXXXXXXXXXX
4356546           Feb                     XXXXXXXXXXX

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may refer to below measures. Attached the simplified sample file.

New Starters =
VAR lastmonth =
    CALCULATETABLE (
        VALUES ( Table1[Employee ID] ),
        FILTER ( ALL ( Table1 ), Table1[MonthNo] = MAX ( Table1[MonthNo] ) - 1 )
    )
RETURN
    IF (
        MAX ( Table1[MonthNo] ) = 1,
        CALCULATE ( COUNT ( Table1[Employee ID] ) ),
        CALCULATE (
            COUNT ( Table1[Employee ID] ),
            FILTER ( Table1, NOT ( Table1[Employee ID] ) IN lastmonth )
        )
    )
Leavers =
VAR lastmonth =
    CALCULATETABLE (
        VALUES ( Table1[Employee ID] ),
        FILTER ( ALL ( Table1 ), Table1[MonthNo] = MAX ( Table1[MonthNo] ) - 1 )
    )
RETURN
    IF (
        MAX ( Table1[MonthNo] ) = 1,
        0,
        CALCULATE (
            COUNT ( Table1[Employee ID] ),
            FILTER ( ALL ( Table1 ), Table1[MonthNo] = MAX ( Table1[MonthNo] ) - 1 )
        )
            - CALCULATE (
                COUNT ( Table1[Employee ID] ),
                FILTER ( Table1, Table1[Employee ID] IN lastmonth )
            )
    )

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

Could you tell me if your problem has been solved? If it is, kindly mark the helpful answer as a solution if you feel that makes sense. Welcome to share your own solution. More people will benefit from here.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may refer to below measures. Attached the simplified sample file.

New Starters =
VAR lastmonth =
    CALCULATETABLE (
        VALUES ( Table1[Employee ID] ),
        FILTER ( ALL ( Table1 ), Table1[MonthNo] = MAX ( Table1[MonthNo] ) - 1 )
    )
RETURN
    IF (
        MAX ( Table1[MonthNo] ) = 1,
        CALCULATE ( COUNT ( Table1[Employee ID] ) ),
        CALCULATE (
            COUNT ( Table1[Employee ID] ),
            FILTER ( Table1, NOT ( Table1[Employee ID] ) IN lastmonth )
        )
    )
Leavers =
VAR lastmonth =
    CALCULATETABLE (
        VALUES ( Table1[Employee ID] ),
        FILTER ( ALL ( Table1 ), Table1[MonthNo] = MAX ( Table1[MonthNo] ) - 1 )
    )
RETURN
    IF (
        MAX ( Table1[MonthNo] ) = 1,
        0,
        CALCULATE (
            COUNT ( Table1[Employee ID] ),
            FILTER ( ALL ( Table1 ), Table1[MonthNo] = MAX ( Table1[MonthNo] ) - 1 )
        )
            - CALCULATE (
                COUNT ( Table1[Employee ID] ),
                FILTER ( Table1, Table1[Employee ID] IN lastmonth )
            )
    )

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.