Tableau Course
HR Analysis Project
HR dashboards answer people questions — where is headcount growing, which departments are losing staff, how is salary distributed, and where are the retention risks. This project builds a complete workforce dashboard from a single employee table using five analytical views and six calculated fields.
The Dataset
A 30-row employee table with hire date, department, status, salary, tenure, and performance rating. Save as hr_data.csv.
Emp_ID,Name,Department,Status,Hire_Year,Salary,Tenure_Years,Performance,Gender
E001,Alice Chen,Engineering,Active,2019,95000,5,High,F
E002,Bob Marsh,Sales,Active,2021,62000,3,Medium,M
E003,Carol Patel,HR,Active,2020,58000,4,High,F
E004,David Kim,Engineering,Active,2018,108000,6,High,M
E005,Eva Rossi,Marketing,Left,2020,71000,3,Medium,F
E006,Frank Obi,Sales,Active,2022,55000,2,Low,M
E007,Grace Liu,Engineering,Active,2017,120000,7,High,F
E008,Henry Park,HR,Left,2021,54000,2,Low,M
E009,Iris Müller,Marketing,Active,2019,78000,5,High,F
E010,James Tran,Sales,Left,2022,50000,1,Low,M
E011,Karen Blake,Engineering,Active,2016,132000,8,High,F
E012,Liam Nkosi,Operations,Active,2020,67000,4,Medium,M
E013,Maya Singh,Marketing,Active,2021,74000,3,High,F
E014,Noah Hart,Operations,Left,2022,61000,1,Low,M
E015,Olivia Diaz,Sales,Active,2020,68000,4,Medium,F
E016,Paul Yuen,Engineering,Left,2021,89000,2,Medium,M
E017,Quinn Adams,HR,Active,2018,62000,6,Medium,F
E018,Rachel Brooks,Operations,Active,2019,72000,5,High,F
E019,Sam Okafor,Sales,Active,2021,60000,3,Medium,M
E020,Tina Vogel,Marketing,Left,2021,69000,2,Low,F
E021,Uma Patel,Engineering,Active,2020,97000,4,High,F
E022,Victor Leung,Operations,Active,2022,65000,2,Medium,M
E023,Wren Johansson,HR,Left,2022,52000,1,Low,F
E024,Xander Mills,Sales,Active,2019,72000,5,High,M
E025,Yara Hassan,Engineering,Active,2021,101000,3,High,F
E026,Zoe Carter,Marketing,Active,2020,77000,4,High,F
E027,Aaron Lee,Operations,Left,2021,63000,2,Low,M
E028,Beth Simmons,Sales,Left,2022,48000,1,Low,F
E029,Chris Varma,Engineering,Active,2022,88000,2,Medium,M
E030,Diana Fox,HR,Active,2020,60000,4,Medium,F
The Five Business Questions
| # | Business Question | Technique | Chart |
|---|---|---|---|
| Q1 | How is headcount distributed across departments and status? | COUNTD by dimension + stacked bar | Stacked bar chart |
| Q2 | Which departments have the highest attrition rate? | Attrition Rate % (FIXED LOD) | Horizontal bar with reference line |
| Q3 | How is salary distributed — are there outliers? | Box plot + average reference line | Box plot by department |
| Q4 | Does higher tenure correlate with higher performance? | Scatter plot + trend line | Scatter plot |
| Q5 | Is there a salary gap between genders in the same department? | Average salary by Gender + FIXED LOD gap calc | Side-by-side dot plot |
Step 1 — Connect and Prepare
hr_data.csv. Verify types: Salary and Tenure_Years as Number (decimal), Hire_Year as Number (whole), all others as String.Step 2 — Build the Calculated Fields
COUNTD([Emp_ID])
{FIXED [Department] :
COUNTD(IF [Status] = "Left" THEN [Emp_ID] END)
} /
{FIXED [Department] :
COUNTD([Emp_ID])
}
{FIXED [Department], [Gender] : AVG([Salary])}
{FIXED [Department] : AVG(IF [Gender] = "F" THEN [Salary] END)}
-
{FIXED [Department] : AVG(IF [Gender] = "M" THEN [Salary] END)}
IF [Performance] = "High" THEN 3
ELSEIF [Performance] = "Medium" THEN 2
ELSEIF [Performance] = "Low" THEN 1
END
IF [Status] = "Left" AND [Performance] = "High" THEN "High Risk Lost"
ELSEIF [Status] = "Left" THEN "Left"
ELSE "Active"
END
Step 3 — Chart 1: Headcount by Department and Status (Q1)
Step 4 — Chart 2: Attrition Rate by Department (Q2)
Step 5 — Chart 3: Salary Distribution Box Plot (Q3)
$#,##0,\K. Title: Engineering Salaries Highest and Most Spread — Two Outliers Above $120K. Tab: Salary Distribution.Step 6 — Chart 4: Tenure vs Performance Scatter Plot (Q4)
Step 7 — Chart 5: Salary Gap by Department (Q5)
+$#,##0;-$#,##0 — positive (F earns more) shows green, negative (M earns more) shows red. Add Avg Salary by Gender to the Tooltip.$#,##0,\K. Title: Women Earn More in Engineering and Marketing — Gap Reversed in Sales. Tab: Salary Gap.Step 8 — Assemble the Dashboard
The Attrition Rate FIXED LOD is the most important calculation in this project. Without it, filtering the view to Active employees only would make the "Left" count drop to zero, making attrition look like zero percent. FIXED ignores view-level filters and calculates over the entire department regardless of what the user selects — so the rate stays honest even when the user drills into a subset. Any metric that measures absence or departure needs this approach: you must count the whole group in the denominator, not just what is visible in the view.
Practice Questions
1. The Headcount field uses COUNTD([Emp_ID]) instead of COUNT or SUM. What is the difference and why is COUNTD the correct choice for a headcount measure?
2. The box plot and scatter plot both need to show one mark per employee rather than one aggregated mark per department. How do you disaggregate the view in Tableau to achieve this?
3. A viewer filters the Headcount chart to show only Active employees. Why does the Attrition Rate % still show the correct percentage rather than dropping to zero?
Quiz
1. The scatter plot uses a Performance Score calculated field rather than the raw Performance text field. Why is the conversion from text to number necessary for this chart?
2. How is the box plot overlay added to the salary distribution chart in Tableau?
3. The scatter plot highlights certain departed employees in red. Which calculated field creates this highlight and what does it identify?
Next up — Lesson 54: Retail Analysis Project — building a retail performance dashboard covering product sales, basket analysis, store comparison, and seasonal trends.