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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
rush
Helper V
Helper V

How to work out Attrition for Staff

I have a table with Staff data with columns DateEmployed & TerminationDate and a DateTable.

 

I would like to work out the number of people that started & left (which I used a count formula) as well as the net growth for all date periods.

 

The formula would count each DateEmployed as 1 & if an individual does not have a Termination Date then it would not count it. e.g. 4 people starts in June 2016 & 2 leaves in June 2016 giving me a net value of 2.

 

I would like to display all 3 dimensions of data in one graph as well.

 

My formula does not count correctly & brings up incorrect data.

 

Starting: Measure counting the people starting in each month or year.

Starting =
CALCULATE (
    COUNT ( 'Table'[FullName] ),
    FILTER (
        ALL ( 'Table' ),
        COUNTROWS (
            FILTER (
                'Table',
                NOT ISBLANK ( [DateEmployed] )
                    && MONTH ( EARLIER ( 'Table'[DateEmployed] ) ) = MONTH ( MAX ( DateTable[Date] ) )
            )
        )
    )
)

 

DateTable = CALENDAR (DATE(2016,1,1), DATE(2016,12,31))

 

Starting: Measure counting the people starting in each month or year.

Starting =
CALCULATE (
    COUNT ( 'Table'[FullName] ),
    FILTER (
        ALL ( 'Table' ),
        COUNTROWS (
            FILTER (
                'Table',
                NOT ISBLANK ( [DateEmployed] )
                    && MONTH ( EARLIER ( 'Table'[DateEmployed] ) ) = MONTH ( MAX ( DateTable[Date] ) )
            )
        )
    )
)

 

Ending: Measure for counting the people ending in each month or year.

Ending =
CALCULATE (
    COUNT ( 'Table'[FullName] ),
    FILTER (
        ALL ( 'Table' ),
        COUNTROWS (
            FILTER (
                'Table',
                NOT ISBLANK ( [TerminationDate] )
                    && MONTH ( EARLIER ( 'Table'[TerminationDate] ) )
                        = MONTH ( MAX ( DateTable[Date] ) )
            )
        )
    )
)


Net:
Total for each month:

Total = ABS([Starting] - [Ending]) 

 

2 ACCEPTED SOLUTIONS
v-sihou-msft
Microsoft Employee
Microsoft Employee

@rush

 

In this scenario, since you need display the [starting] and [ending] in same graph, the easiest way is creating two calculated tables, one for Staff Employed, the the ohter for Staff Terminated. Each table can build relationship to Calendar table with date column. Then you just need to create simple measures like "=COUNTA('Table'[FullName])", it will be aggregated on corresponding level when putting the Calendar hierarchy into a chart visual.

 

Regards,

View solution in original post

Hi Thank you very much. It works well.

 

 

View solution in original post

3 REPLIES 3
v-sihou-msft
Microsoft Employee
Microsoft Employee

@rush

 

In this scenario, since you need display the [starting] and [ending] in same graph, the easiest way is creating two calculated tables, one for Staff Employed, the the ohter for Staff Terminated. Each table can build relationship to Calendar table with date column. Then you just need to create simple measures like "=COUNTA('Table'[FullName])", it will be aggregated on corresponding level when putting the Calendar hierarchy into a chart visual.

 

Regards,

Hi,

I am new to Power BI. Could you please explain the same with sample data / tables. 

Regards,

Hi Thank you very much. It works well.

 

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.