An end-to-end HR Analytics and Workforce Intelligence project that analyzes employee attrition using Python, SQL Server, T-SQL, Power BI, and DAX.
The project transforms raw employee data into meaningful workforce insights through exploratory data analysis, SQL-based data processing and validation, business analysis, and an interactive Power BI dashboard.
Employee attrition is an important workforce metric that can help organizations understand workforce stability and identify employee segments with higher observed attrition.
This project analyzes attrition across key workforce dimensions such as tenure, overtime, salary, job satisfaction, work-life balance, department, and job role.
The project follows an end-to-end analytics workflow:
- Exploratory Data Analysis using Python
- SQL Server database setup
- Data loading and validation
- SQL-based business analysis
- Power BI data modeling
- DAX KPI calculations
- Interactive workforce dashboard
- Workforce attrition insights
- π₯ Workforce & Employee Analysis
- πͺ Employee Attrition Analysis
- π Attrition Rate Calculation
- π Python Exploratory Data Analysis
- ποΈ SQL Server Database
- πΎ T-SQL Business Analysis
- π Data Validation
- π Power BI Dashboard
- π DAX Measures & KPIs
- π Tenure Analysis
- β° Overtime Analysis
- π° Salary Analysis
- π Job Satisfaction Analysis
- βοΈ Work-Life Balance Analysis
- π’ Department Analysis
- πΌ Job Role Analysis
Organizations collect employee information across departments, job roles, compensation, tenure, overtime, satisfaction, and other workforce attributes.
However, raw employee records make it difficult to quickly identify patterns in employee attrition.
This project provides an analytical solution to answer questions such as:
- What is the overall employee attrition rate?
- Which workforce segments show higher observed attrition?
- How does attrition vary across employee tenure?
- Do overtime employees show higher observed attrition?
- Does lower salary correspond with higher observed attrition?
- How does job satisfaction relate to observed attrition?
- How does work-life balance relate to observed attrition?
- Which departments and job roles show comparatively higher attrition?
The goal is to transform employee-level data into a clear and interactive workforce intelligence solution.
- Analyze employee attrition patterns.
- Calculate the overall attrition rate.
- Identify higher-attrition workforce segments.
- Analyze attrition across tenure bands.
- Compare overtime and non-overtime employees.
- Analyze salary-based attrition patterns.
- Examine job satisfaction and attrition.
- Examine work-life balance and attrition.
- Compare departments and job roles.
- Build an interactive Power BI dashboard.
- Present workforce findings in a business-friendly format.
Raw Employee Dataset
β
βΌ
Exploratory Data Analysis
β
βΌ
Data Preparation
β
βΌ
SQL Server Database
β
βΌ
Data Loading
β
βΌ
Data Validation
β
βΌ
Business Analysis
β
βΌ
Power BI Data Model
β
βΌ
DAX Measures
β
βΌ
Interactive HR Dashboard
β
βΌ
Workforce Insights
| Category | Technology |
|---|---|
| π Programming Language | Python |
| π Data Analysis | Pandas |
| π Notebook | Jupyter Notebook |
| ποΈ Database | Microsoft SQL Server |
| πΎ Query Language | T-SQL |
| π Business Intelligence | Power BI |
| π Analytical Calculations | DAX |
| π Version Control | Git |
| βοΈ Repository Hosting | GitHub |
workforce-intelligence-hr-analytics/
β
βββ data/
β βββ raw/
β βββ WA_Fn-UseC_-HR-Employee-Attrition.csv
β
βββ notebooks/
β βββ 01_Exploratory_Data_Analysis.ipynb
β
βββ powerbi/
β βββ Workforce_Intelligence_HR_Analytic.pbix
β
βββ sql/
β βββ 01_database_schema.sql
β βββ 02_data_loading.sql
β βββ 03_data_validation.sql
β βββ 04_business_analysis.sql
β
βββ .gitignore
βββ LICENSE
βββ README.md
βββ requirements.txt
The project uses the IBM HR Analytics Employee Attrition & Performance dataset.
The dataset contains employee-level information covering areas such as:
- Employee demographics
- Department
- Job role
- Job level
- Monthly income
- Overtime
- Job satisfaction
- Work-life balance
- Years at company
- Employment attributes
- Attrition
The raw dataset is stored at:
data/raw/WA_Fn-UseC_-HR-Employee-Attrition.csv
Exploratory Data Analysis is performed using Python, Pandas, and Jupyter Notebook.
The EDA process is used to understand the dataset before SQL-based analysis.
Key activities include:
- Dataset structure inspection
- Data type checks
- Missing-value analysis
- Duplicate checks
- Employee distribution analysis
- Attrition distribution
- Numerical analysis
- Categorical analysis
- Workforce segmentation
- Initial attrition analysis
The notebook is available at:
notebooks/01_Exploratory_Data_Analysis.ipynb
The SQL component processes and analyzes the employee dataset using Microsoft SQL Server and T-SQL.
The workflow is organized into four scripts.
sql/01_database_schema.sql
Creates the database structure required for the project.
sql/02_data_loading.sql
Loads the employee dataset into the SQL Server environment.
sql/03_data_validation.sql
Performs data-quality and consistency checks before analysis.
sql/04_business_analysis.sql
Contains SQL queries used to analyze employee attrition and workforce segments.
The final reporting layer is built using Microsoft Power BI.
The dashboard combines workforce KPIs and employee segmentation into an interactive analytical interface.
Power BI file:
powerbi/Workforce_Intelligence_HR_Analytic.pbix
The dashboard focuses on:
- π₯ Workforce size
- πͺ Attrition
- π Attrition rate
- π Tenure
- β° Overtime
- π° Salary
- π Job satisfaction
- βοΈ Work-life balance
- π’ Department
- πΌ Job role
DAX measures are used in Power BI to calculate workforce metrics dynamically.
Key analytical measures include:
- Total Employees
- Employees Who Left
- Attrition Rate
- Segment-level Attrition Rate
These measures allow dashboard visuals and KPIs to respond dynamically to report interactions and filters.
The analysis identified several workforce segments with comparatively higher observed attrition.
| Workforce Segment | Employees | Employees Left | Observed Attrition Rate |
|---|---|---|---|
| π Early Tenure (0β1 Years) | 215 | 75 | 34.88% |
| βοΈ Low Work-Life Balance | 80 | 25 | 31.25% |
| β° Overtime Employees | 416 | 127 | 30.53% |
| π° Low Salary (< 3K) | 395 | 113 | 28.61% |
| π Low Job Satisfaction | 289 | 66 | 22.84% |
The overall workforce baseline is:
| Metric | Value |
|---|---|
| π₯ Total Employees | 1,470 |
| πͺ Employees Who Left | 237 |
| π Overall Attrition Rate | 16.12% |
The analysis highlights several areas that could be investigated further:
Employees with 0β1 years of tenure recorded the highest observed attrition rate among the analyzed segments.
Employees working overtime showed a substantially higher observed attrition rate than the overall workforce baseline.
The lower work-life balance segment also showed elevated observed attrition.
Employees in the lower-salary segment recorded a higher observed attrition rate compared with the overall workforce.
Lower job satisfaction was associated with a comparatively higher observed attrition rate in the dataset.
These findings can help identify workforce areas that may deserve deeper HR investigation.
The results represent observed relationships within the available dataset.
A higher attrition rate within a particular segment does not prove that the corresponding characteristic causes employees to leave.
For example, the higher observed attrition among overtime employees does not establish that overtime itself causes attrition.
The findings should therefore be treated as exploratory workforce insights and a starting point for further analysis.
git clone https://github.com/harsh8767/Workforce-Intelligence-HR-Analytics.gitcd Workforce-Intelligence-HR-Analyticspython -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activatepip install -r requirements.txtOpen:
notebooks/01_Exploratory_Data_Analysis.ipynb
Run the notebook using Jupyter Notebook or JupyterLab.
jupyter notebookExecute the SQL scripts in this order:
01_database_schema.sql
β
02_data_loading.sql
β
03_data_validation.sql
β
04_business_analysis.sql
These scripts create the database environment, load the data, validate the dataset, and perform workforce analysis.
Open:
powerbi/Workforce_Intelligence_HR_Analytic.pbix
using Power BI Desktop.
If required, update the SQL Server data-source connection and refresh the data model.
Data validation is performed before business analysis to improve confidence in the analytical results.
The validation process includes checks for:
- Record counts
- Missing values
- Duplicate records
- Data consistency
- Key fields
- Attribute values
Validation logic is available in:
sql/03_data_validation.sql
Potential future enhancements include:
- π Attrition trend analysis
- π€ Machine learning-based attrition prediction
- π₯ Employee segmentation
- π Advanced HR KPIs
- π Power BI drill-through pages
- π Monthly and yearly attrition analysis
- π± Power BI mobile layout
- βοΈ Power BI Service deployment
- β‘ Automated data refresh
- π Row-level security
This project was developed using:
- Python
- Pandas
- Jupyter Notebook
- Microsoft SQL Server
- T-SQL
- Microsoft Power BI
- DAX
- Git
- GitHub
Passionate about Data Analytics, Business Intelligence, SQL, Power BI, Python, Machine Learning, and Artificial Intelligence.
GitHub
https://www.linkedin.com/in/harsh-chavan-1646a2257/
This project is licensed under the MIT License.
See the LICENSE file for more information.
If you found this project useful:
- β Star the repository
- π΄ Fork the repository
- π‘ Share your feedback
- π Report issues
- π Suggest improvements
Workforce Intelligence β HR Analytics demonstrates an end-to-end HR analytics workflow:
Raw Employee Data
β
Python EDA
β
SQL Server
β
Data Validation
β
Business Analysis
β
Power BI + DAX
β
Workforce Insights
The project demonstrates practical skills in data analysis, SQL, database processing, business intelligence, DAX, data visualization, and workforce analytics.
The final dashboard transforms employee-level data into an interactive view of attrition patterns and workforce segments, providing a foundation for data-driven HR analysis.
If you found the project useful, don't forget to β the repository.
Happy Learning & Analyzing! π
