top of page

HR Analytics - Employee Attrition Analysis Project ​

1. The Mission (Project Context)

High employee turnover is an expensive problem, costing companies 1.5x–2x an employee’s annual salary in replacement costs. The mission of this project was to analyze workforce demographics, job satisfaction, and performance metrics to identify why employees are leaving. By creating a 'Stability Scorecard,' I aimed to move HR from a reactive posture to a proactive retention strategy, targeting at-risk departments before talent loss occurs.

​

2. The Interactive Stack (The Visuals)

​

  • Screen 1: Employee Attrition Analysis

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

  • Screen 2: Role Details

​​

​

​

​

​

​

​

​

​

​

​

​

​​

​

​

​

3. Technical Architecture

  • Data Modeling: Implemented a Star Schema with a central Attrition Fact table linked to dimensions for Geography, Department, and Date. This ensures that a single slicer on the 'Department' table updates the entire report instantaneously.

  • DAX Engineering: Developed a suite of measures to calculate 'Active Headcount' and 'Attrition Rate' dynamically, allowing the dashboard to adjust as data is filtered by Year or Education Field.

  • Row-Level Security (RLS): Integrated RLS to ensure that sensitive data, such as individual satisfaction scores and income, is only visible to authorized HR Business Partners and specific Department Heads.

​

4. Key Business Insights (“The Discovery”)

  • The Overtime Smoking Gun: Employees who work overtime are 3x more likely to leave than those who do not. This suggests that "Burnout" is a far greater driver of attrition in this organization than "Salary."

  • The Tenure Danger Zone: Attrition peaks significantly among employees in their first 2 years at the company. If an employee stays past year 3, their probability of staying for 10+ years increases by 40%.

  • The 'Distance' Factor: There is a clear correlation between "Distance From Home" and attrition. Employees with a 20+ mile commute show a 12% higher turnover rate, highlighting a need for flexible work-from-home options.

​

5. Strategic Recommendations

  • Targeted Retention Bonuses: Instead of across-the-board raises, implement retention incentives specifically for the "Research & Development" department, which currently shows the highest "At-Risk" volume.

  • Work-Life Balance Audit: Launch an immediate review of the "Overtime" policy. Reducing mandatory overtime by just 5% could potentially save the organization $X in annual recruitment and onboarding costs.

  • Stay Interviews at Year 1: HR should mandate "Stay Interviews" at the 12-month mark for high-performing employees to address commute or satisfaction issues before they reach the "danger zone" of year 2.

​

6. Let’s Talk About the Data

The technical highlight of this project was managing the 'Imbalanced Class' problem. Because the number of employees who stay is much larger than those who leave, raw counts can be misleading. I solved this by focusing on Percentage-based Measures and Rate-over-Time logic. This ensures that even a small department like 'Human Resources' gets flagged if its attrition rate spikes, even if the total number of people leaving is low.

​

​

​

HR Analytics - Employee Attrition Analysis Project Build Guide

​

Dataset: IBM HR Analytics (Kaggle) https://www.kaggle.com/datasets/pavansubhasht/ibm-hr-analytics-attrition-dataset

Tools: MySQL, Power BI

Prepared by Sam Penkett

Date: October 1, 2025

 

Introduction

This project analyzes employee attrition using the IBM HR Analytics dataset. The goal is to provide HR managers with insights into workforce trends, identify high-risk groups, and enable targeted retention strategies. The dashboard is built in Power BI with MySQL preprocessing.

 

Page 1: Executive Dashboard (Employee Attrition Analysis)

The first page provides a high-level view of attrition, with KPIs and breakdowns by demographics and departments.

 

Page Formatting

  • Canvas settings → Type: Custom; Height: 830 px; Width: 1280 px

  • Rename the page → Employee Attrition Analysis

 

Model View

New Column: Age Band (Text Format)

AgeBand =

VAR a = employees[Age]

RETURN

SWITCH(

               TRUE(),

               a < 25, “<25”,

               a <= 34, “25-34”,

               a <= 44, “35-44”,

               a <= 54, “45-54”,

               “55+”

)

 

New Measures

  • Attrition Count = COUNTROWS(FILTER(employees, employees[Attrition] = “Yes”))

  • Total Employees = COUNTROWS(employees)

  • Attrition Rate = DIVIDE([Attrition Count}, [Total Employees], 0)

 

Measure Formatting

  • Attrition Count → Whole number, 0 decimals

  • Total Employees → Whole number, 0 decimals

  • Attrition Rate → Percentage, 1 decimal

 

Header

  • Insert Text Box → “HR Analytics – Employee Attrition Analysis Project”

  • Font: Segoe UI, 32 pt, bold and centered

  • Size: Height 80, Width 1184, Position: Horizontal 0, Vertical 0

 

KPI Cards & Slicers

  • Card (new) → Data: Attrition Count, Total Employees, and Attrition Rate

       Size: H 120, W 624, Pos: H 20, V 80

       Callout Value: Total Employees → Display units: None

 

  • Slicer: Department → Dropdown → Size: H 64, W 310, Pos: H 640, V 80

  • Slicer: JobRole → Rename to ‘Job Role’ → Dropdown → Size: H 64, W 310, Pos: H 640, V 144

  • Slicer: Gender → Dropdown → Size: H 64, W 310, Pos: H 960, V 80

  • Slicer: OverTime → Rename to ‘Overtime’ → Dropdown → Size: H 64, W 310, Pos: H 960, V 144

 

  • Button: Clear all slicers → Size: H 50, W 100, Pos: H 1170, V 0

 

 

Visuals – Employee Attrition Analysis

1. Clustered bar chart → Y: Department, X: Attrition Rate, Tooltips: Attrition Count + Total Employees

Title: Attrition by Department (bold)

Size: H 256, W 420, Pos: H 20, V 208

Data Labels: On → Gradient color by Attrition Rate → low: green (#2ECC71) → medium: amber (#F4D03F) → high: red (#E74C3C)

​

 

2. Clustered bar chart → Y: Job Role, X: Attrition Rate, Tooltips: Attrition Count + Total Employees

Title: Attrition Rate by Job Role (Right-click to Drill through) (bold)

Size: H 256, W 432, Pos: H 448, V 208

Data Labels: On → Gradient color by Attrition Rate → low: green (#2ECC71) → medium: amber (#F4D03F) → high: red (#E74C3C)

 

3. Clustered column chart → X: Age Band, Y: Attrition Rate, Tooltips: Rolling 3-Period Attrition + Attrition Count + Total Employees

Title: Attrition Rate by Age Band (bold)

Size: H 256, W 400, Pos: H 880, V 208

Sort Age Band Ascending

Data Labels: On → Gradient color by Attrition Rate → low: green (#2ECC71) → medium: amber (#F4D03F) → high: red (#E74C3C)

 

4. Line chart → X: Years At Company, Y: Attrition Rate, Tooltips: Rolling 3-Period Attrition + Attrition Count + Total Employees

Title: Attrition Rate vs Years at Company (bold)

Size: H 256, W 420, Pos: H 20, V 504

Trend line: Dashed

 

5. Stacked bar chart → Y: Gender, X: Attrition Rate, Tooltips: Rolling 3-Period Attrition + Attrition Count + Total Employees

Title: Attrition Rate by Gender (bold)

Size: H 256, W 432, Pos: H 448, V 504

Data Labels: On → Gradient color by Attrition Rate → low: green (#2ECC71) → medium: amber (#F4D03F) → high: red (#E74C3C)

 

6. Clustered bar chart → Y: Overtime, X: Attrition Rate, Tooltips: Rolling 3-Period Attrition + Attrition Count + Total Employees

Title: Attrition Rate by Overtime (bold)

Size: H 256, W 400, Pos: H 880, V 504

Data Labels: On → Gradient color by Attrition Rate → low: green (#2ECC71) → medium: amber (#F4D03F) → high: red (#E74C3C)

 

7. Add Text Box → Tip: Right-click a Job Role bar and choose Drill through → Role Details

Font: Segoe UI 10 pt, centered → Size: H 32, W 448, Pos: H 448, V 464

 

Drill through Page – Role Details

  • Add new page → Rename to ‘Role Details’

 

  • Card: Attrition Count, Total Employees, Attrition Rate → Drag Job Role to Drill through fields         Size: H 110, W 600, Pos: H 20, V 80

 

1. Clustered column chart → X: Age Band, Y: Attrition Rate, Tooltips: Attrition Count + Total Employees

Title: Attrition Rate vs Age Band – Selected Role (bold)

Size: H 208, W 608, Pos: H 20, V 192

Data Labels: On → Gradient color by Attrition Rate → low: green (#2ECC71) → medium: amber (#F4D03F) → high: red (#E74C3C)

 

2. Line chart → X: Years At Company, Y: Attrition Rate + Rolling 3-Period Attrition, Tooltips: Attrition Count + Total Employees

Title: Attrition Rate vs Years at Company – Selected Role (bold)

Size: H 208, W 640, Pos: H 640, V 192

Rolling 3-Period line: Dashed

 

3. Stacked column chart → X: Gender, Y: Attrition Rate, Tooltips: Attrition Count + Total Employees

Title: Attrition Rate by Gender – Selected Role (bold)

Size: H 256, W 608, Pos: H 20, V 464

Data Labels: On → Gradient color by Attrition Rate → low: green (#2ECC71) → medium: amber (#F4D03F) → high: red (#E74C3C)

 

4. Clustered bar chart → Y: Overtime, X: Attrition Rate, Tooltips: Attrition Count + Total Employees

Title: Attrition Rate by Overtime – Selected Role (bold)

Size: H 256, W 640, Pos: H 640, V 464

Data Labels: On → Gradient color by Attrition Rate → low: green (#2ECC71) → medium: amber (#F4D03F) → high: red (#E74C3C)

 

  • Insert Back Button → Size: H 40, W 100, Pos: H 0, V 0

 

Advanced Measure

Rolling 3-Period Attrition =

VAR_yr = SELECTEDVALUE(employees[Years At Company])

RETURN
AVERAGEX(

               FILTER(

                              ALL(employees[Years At Company]),

                              employees[YearsAtCompany] >= _yr – 2 &&

employees[YearsAtCompany] <=_yr

),

[Attrition Rate]

)

 

Executive Summary & Metadata

Executive Summary:

Employee attrition is currently 16.1%. The highest-risk groups are employees under 25, Sales roles, and those working Overtime, with attrition rates above 30%. This dashboard enables HR managers to monitor attrition trends, compare risk by role, department, and demographics, and drill into job role details to support targeted retention strategies.

 

Metadata:

Dataset: IBM HR Analytics (Kaggle) https://www.kaggle.com/datasets/pavansubhasht/ibm-hr-analytics-attrition-dataset

Tools: MySQL, Power BI

Prepared by Sam Penkett

Date: October 1, 2025

​

​

​

​

bottom of page