1) Prepare the basic calculated fields (KPI building blocks)
Create these calculated fields in Tableau (Analysis → Create
Calculated Field).
1. Employee Count
Name: Employee Count
Formula:
2. COUNT([EmployeeNumber])
3. Attrition Count
Name: Attrition Count
Formula:
4. COUNT(
5. IF [Attrition] = 'Yes' THEN [EmployeeNumber] END
6. )
(Alternatively use SUM(IF [Attrition]='Yes' THEN 1 ELSE 0 END) )
7. Attrition Rate (%)
Name: Attrition Rate %
Formula:
8. IF COUNT([EmployeeNumber]) = 0 THEN 0
9. ELSE
10. (COUNT(IF [Attrition] = 'Yes' THEN
[EmployeeNumber] END)
11. / COUNT([EmployeeNumber])) * 100
12. END
13. Active Employees
Name: Active Employees
Formula:
14. COUNT([EmployeeNumber]) - COUNT(IF [Attrition] =
'Yes' THEN [EmployeeNumber] END)
(Or SUM(IF [Attrition] = 'No' THEN 1 ELSE 0 END) )
15. Average Age
Name: Average Age
Formula:
16. AVG([Age])
2) KPI cards (single-number tiles)
Make single-number KPI sheets and then put them into a dashboard.
For each KPI (e.g., Employee Count):
1. Create a new sheet called KPI - Employee Count.
2. Drag the measure Employee Count to Text on the Marks card.
3. Click the Text shelf, format the font and size to make it look like
a KPI tile (large font for number, smaller subtitle).
o You can add a subtitle by editing the text to: <Measure
Names> / <Measure Values> or by making a calculated
field like "Employees\n" + STR([Employee Count]).
4. Remove row/column headers (Worksheet → Show Header
uncheck).
5. Repeat for Attrition Count, Attrition Rate % (format as
percentage or number with 2 decimals), Active Employees,
Average Age (format to 2 decimals).
Finally: Dashboard → New Dashboard. Drag the KPI sheets into the
top area in a horizontal layout. Use blank objects for spacing and
format background color and border to match the style from your lab
manual.
3) Lollipop chart: Attrition rate by Gender (simulate lollipop)
Goal: show a line (or bar) with a circle at the end (male vs female).
Method (dual-axis approach):
1. Create a sheet Lollipop - Attrition by Gender.
2. Create a calculated field Attrition Rate (by Gender):
3. COUNT(
4. IF [Attrition] = 'Yes' THEN [EmployeeNumber] END
5. ) / COUNT([EmployeeNumber])
(Note: this is a table-level expression by Gender when Gender is on
Rows; it returns a fraction — format as %.)
6. Drag Gender to Rows.
7. Drag the measure Attrition Rate (by Gender) to Columns — this
creates bars when you change mark types.
8. On the Marks card, switch to Bar for the first axis.
9. Duplicate the pill Attrition Rate (by Gender) on the Columns
shelf (Ctrl + drag the pill). You now have two axes (Attrition
Rate (2)).
10. For the second measure on the Marks shelf, change mark
type to Circle.
11. Right-click the second axis pill → Dual Axis.
12. Right-click one of the axes → Synchronize Axis (if
needed), but usually you want the same scale; then hide the axis
headers (right-click → Show Header to uncheck).
13. On the Bar marks, size the bar narrow (to show a stick).
For the Circle marks, increase size so the circle is visible at the
end of each bar.
14. Format: add labels on the circle marks (Label → Show
mark labels) with percent formatting: right-click label → Format
→ Number → Percentage (1 or 2 decimals).
15. Clean up: remove gridlines and borders, set tooltips, color
the circle differently (e.g., gender colors).
This produces the classic lollipop look: a thin bar/stem and a circle at
the tip.
4) Pie chart: Attrition percentage by Department
We want percentages of attrition across departments (i.e., of
attritioned employees, what percent by department).
Steps:
1. Create a sheet Pie - Attrition by Department.
2. Filter the sheet: drag Attrition to Filters → select Yes. (We are
only counting attrition events.)
3. Drag Department to Color or Label on Marks.
4. Drag EmployeeNumber to Angle on Marks and change
aggregation to COUNT (or drag created Attrition Count measure
to Angle). Tableau will sum counts and create slices.
5. On Marks, change mark type to Pie.
6. Drag EmployeeNumber (COUNT) also to Label and set Label
to show Percent of Total: click Label → text → Insert → choose
Quick Table Calculation → Percent of Total OR: right-click the
label pill → Quick Table Calculation → Percent of Total.
Format as percentage.
7. Optionally add the raw attrition count to the tooltip or label by
adding COUNT(EmployeeNumber) to Tooltip.
8. To show the total in the title or as an annotation: compute a field
Total Attrition (a single-value worksheet or use ATTR
aggregations) and add it to the dashboard as a KPI.
COUNT(
IF [Attrition] = 'Yes' THEN [EmployeeNumber] END
)
9. Format colors in Color card — pick palette and ensure contrast.
Remove unnecessary legend items or place legend next to pie.
Tip: For “Entire view”, click Fit → Entire View so pie scales to the
plotting area.
5) Bar chart: Number of employees by Age group
We’ll create age bins then a horizontal bar chart.
Method A — Age bins (size = 5 like in your screenshot):
1. Create an Age bin: right-click [Age] → Create → Bins… → Set
Size of bins = 5 → name Age Bin (5).
2. Create a sheet Bar - Employees by Age Bin.
3. Drag Age Bin (5) to Rows. Right-click and convert it to discrete
if necessary.
4. Drag EmployeeNumber to Columns and aggregate to COUNT.
5. Sort bars descending (click sort icon on the axis).
6. To make horizontal bars, keep Age Bin on Rows (this gives
horizontal bars). Format axis and labels.
7. To show counts on bars: on Label (Marks) → Show mark labels.
8. For nicer bin labels (e.g., 20-24), create a calculated field to
display bin ranges:
9. STR(MIN([Age Bin (5)])) + " - " + STR(MAX([Age Bin (5)]) -
1)
(If Age Bins are numeric discrete values, adjust accordingly.)
Method B — Calculated Age Group (if you want named groups:
Under 30, 30–39, 40–49 etc.):
Create calculated field Age Group:
IF [Age] < 30 THEN 'Under 30'
ELSEIF [Age] < 40 THEN '30-39'
ELSEIF [Age] < 50 THEN '40-49'
ELSE '50+'
END
Then use Age Group on Rows and COUNT(EmployeeNumber) on
Columns.
6) Highlight table: Job Satisfaction Rating by Job Role (based on
employee count)
We’ll build a matrix where rows = Job Role, columns = Job
Satisfaction rating, cell color intensity = count of employees.
Steps:
1. Create a new sheet Highlight - JobSatisfaction by JobRole.
2. Drag JobRole to Rows.
3. Drag JobSatisfaction to Columns.
4. Drag EmployeeNumber to Text on the Marks card and set
aggregation to COUNT.
5. On Marks, change mark type to Square (or Automatic / Text).
6. Drag the same COUNT(EmployeeNumber) to Color so color
intensity reflects counts.
7. In the Color legend edit colors: choose a single-hue palette
where higher counts = darker color (or diverging if you prefer).
8. Format labels: Label → Show mark labels (font small but
readable). Format number as integer.
9. Add totals if desired: Analysis → Totals → Show Row Grand
Totals / Column Grand Totals.
10. You can also sort JobRole by total employees (right-click
JobRole → Sort by Field → choose EmployeeNumber COUNT
DESC).
This yields a highlight table (heatmap-like) showing job satisfaction
distribution by job role.
7) Horizontal bar chart: Attrition count by Education Field
Steps:
1. Create sheet Bar - Attrition by EducationField.
2. Filter Attrition = Yes (drag to Filters).
3. Drag EducationField to Rows.
4. Drag EmployeeNumber to Columns and set aggregation to
COUNT.
5. Sort descending; format axis and labels.
6. Optionally switch to Stacked Bar Chart if you want to break
by another dimension (e.g., Gender as color) by dragging
Gender to Color.
7. Format to match the lab styling (remove panes, adjust font).
8) Multiple donut charts: Attrition Rate by Gender for different
Age groups
Tableau doesn’t have a native donut chart — the common technique is
to make a pie and overlay a white circle or use two pie layers. The
easier way: create a pie (attrition by gender) for each age group filter
and then create a “donut hole” by placing a floating blank sheet circle
on top in the dashboard. I’ll give two approaches.
Approach A — Small multiples of pie charts and “donut”
appearance
1. Create a sheet Donut - Attrition Rate by Gender.
2. We want percentage of attrition by gender within each age
group or we want attrition rate (attrition / total) segmented by
gender. Two common interpretations:
o a) For each age group, show among attrition cases the
gender split (i.e., of employees who left in that age group,
what % were male/female).
o b) For each age group and gender, show the attrition rate =
(# attrition & that gender & age group) / (# employees of
that gender & age group).
Pick one consistency. From the Power BI example it looks like they
made donuts showing gender share of attrition within each age group.
I’ll follow that.
3. Filter the sheet to Attrition = 'Yes'.
4. Create Age Group bin or calculated groups exactly as step 4
above (e.g., Under 30, Under 50 etc.), or use the Age Bin you
created earlier.
5. Drag Age Group to Columns. (This will create one small pie per
Age Group when combined with Gender.)
6. Drag Gender to Color.
7. Change Marks to Pie.
8. Drag EmployeeNumber to Angle (COUNT).
9. Drag EmployeeNumber to Label and make it Percent of Total
(Quick Table Calculation → Percent of Total) so each slice
shows percent within that pane.
10. On the toolbar, click Size and reduce pie size to create
space for multiple donuts.
11. Create the donut hole: create a new worksheet Donut Hole
with a circle:
o Create calculated field One = 1.
o Put One on Rows and Columns (make it a circle mark) and
set size large with white color (or dashboard background
color) and remove headers. Set sheet to floating circular
shape is tough — instead, on dashboard you can place this
Donut Hole sheet as a floating object centered on each pie,
or easier: design the dashboard to have smaller pies with a
floating white circle over each pie. (Many Tableau authors
simply live with pies — the white circle is purely
cosmetic.)
12. If using multiple sheets per age group: filter each sheet by
Age Group and duplicate, then place them side-by-side in
dashboard — but using Age Group on Columns with Gender on
Color is simpler (small multiples).
Approach B — Show actual attrition rate by gender for each age
group
If you want: for each Age Group and Gender compute attrition rate:
Create calculated field Attrition Rate by AgeGroup & Gender:
COUNT(
IF [Attrition] = 'Yes' THEN [EmployeeNumber] END
)
/
COUNT([EmployeeNumber])
Then use Age Group on Columns, Gender on Color, and Attrition
Rate by AgeGroup & Gender on Rows (or Angle for pie). Format as
%.
9) Filters and interactivity
• Put common filters (e.g., Age Group, Department,
EducationField, Gender) on the dashboard as Filter cards and
set them to apply to all sheets (right-click filter → Apply to
Worksheets → All Using This Data Source).
• Add highlight actions or filter actions if you want clicks on one
chart to filter others (Dashboard → Actions → Add Action →
Filter).
10) Dashboard layout (final HR analytics dashboard)
1. Create a new Dashboard sized to your page (e.g., 1366×768 or a
custom printed size).
2. Top row: place KPI sheets in a horizontal container —
Employee Count, Attrition Count, Attrition Rate, Active
Employees, Average Age.
3. Middle-left: Lollipop - Attrition by Gender.
4. Middle-center: Bar - Employees by Age Group.
5. Middle-right: Donut - Attrition by Gender (Age) or small
multiples.
6. Bottom-left: Pie - Attrition by Department.
7. Bottom-center: Highlight table - JobSatisfaction by JobRole.
8. Bottom-right: Bar - Attrition by EducationField.
9. Add legends, titles and a subtitle. Use floating objects for
decorative boxes or alignment.
10. Set consistent fonts and colors and add a dashboard Title
like HR Analytics Dashboard.
11) Formatting & polishing tips
• Format numbers: right-click measure → Default Properties →
Number (e.g., Employee Count as Number (Custom) 0
decimals, Attrition Rate as Percentage 1 decimal).
• Use Format pane to remove gridlines, borders and set
background colors similar to the lab manual style.
• Use Tooltips to show useful detail (e.g., raw counts,
percentages, sample sizes).
• When using Quick Table Calculations (Percent of Total), ensure
the Compute Using scope is correct (Table (Across) or Pane
depending on layout). Use Edit Table Calculation to set
direction.
• For age bins, if you want consistent ordering, make Age Group a
Custom Sort or use a calculated numeric code for order and
hide it.
• Save worksheet and workbook and preview as Presentation
Mode or publish to Tableau Server/Public if required.
12) Exact Tableau formulas summary (copy-paste)
• Employee Count:
• COUNT([EmployeeNumber])
• Attrition Count:
• COUNT(IF [Attrition] = 'Yes' THEN [EmployeeNumber] END)
• Attrition Rate %:
• IF COUNT([EmployeeNumber]) = 0 THEN 0
• ELSE (COUNT(IF [Attrition] = 'Yes' THEN
[EmployeeNumber] END) / COUNT([EmployeeNumber])) *
100 END
• Active Employees:
• COUNT([EmployeeNumber]) - COUNT(IF [Attrition] = 'Yes'
THEN [EmployeeNumber] END)
• Average Age:
• AVG([Age])
• Example Age Group (custom):
• IF [Age] < 30 THEN 'Under 30'
• ELSEIF [Age] < 40 THEN '30-39'
• ELSEIF [Age] < 50 THEN '40-49'
• ELSE '50+' END