0
0
Tableaubi_tool~15 mins

Year-over-year comparison in Tableau - Real Business Scenario

Choose your learning style9 modes available
Scenario Mode
👤 Your Role: You are a sales analyst at a retail company.
📋 Request: Your manager wants to see how sales have changed year-over-year to understand growth trends.
📊 Data: You have monthly sales data for the years 2022 and 2023. The data includes Date, Sales Amount, and Region.
🎯 Deliverable: Create a Tableau dashboard that shows monthly sales for 2022 and 2023 side by side, with a calculated field showing the percentage change year-over-year.
Progress0 / 9 steps
Sample Data
DateSales AmountRegion
2022-01-0110000North
2022-02-0112000North
2022-03-0111000North
2023-01-0113000North
2023-02-0112500North
2023-03-0114000North
2022-01-018000South
2022-02-018500South
2022-03-019000South
2023-01-019500South
2023-02-0110000South
2023-03-0110500South
1
Step 1: Connect your Tableau workbook to the sales data source containing Date, Sales Amount, and Region.
No formula needed.
Expected Result
Data is loaded and visible in Tableau's Data pane.
2
Step 2: Create a calculated field named 'Year' to extract the year from the Date field.
YEAR([Date])
Expected Result
The 'Year' field shows 2022 or 2023 for each record.
3
Step 3: Create a calculated field named 'Month' to extract the month name from the Date field.
DATENAME('month', [Date])
Expected Result
The 'Month' field shows month names like 'January', 'February', etc.
4
Step 4: Build a view with 'Month' on Columns and 'SUM(Sales Amount)' on Rows.
Drag 'Month' to Columns shelf, drag 'Sales Amount' to Rows shelf and set aggregation to SUM.
Expected Result
A bar chart or line chart showing total sales per month.
5
Step 5: Add 'Year' to the Color shelf to separate sales by year.
Drag 'Year' to Color on Marks card.
Expected Result
Sales for 2022 and 2023 appear side by side with different colors.
6
Step 6: Create a calculated field named 'YoY Change %' to calculate the percentage change in sales compared to the previous year for each month.
(SUM([Sales Amount]) - LOOKUP(SUM([Sales Amount]), -1)) / ABS(LOOKUP(SUM([Sales Amount]), -1))
Expected Result
The 'YoY Change %' field calculates the month-over-month year change as a decimal.
7
Step 7: Add 'YoY Change %' as a label on the chart for the 2023 data points.
Drag 'YoY Change %' to Label on Marks card and filter to show only for Year = 2023.
Expected Result
Percentage change labels appear above 2023 sales bars or points.
8
Step 8: Format the 'YoY Change %' labels to show as percentages with one decimal place.
Right-click 'YoY Change %' field, select Format, set number format to Percentage with 1 decimal.
Expected Result
Labels show values like 18.2%, -4.0%, etc.
9
Step 9: Create a dashboard combining the monthly sales chart with YoY change labels and add a title 'Year-over-Year Sales Comparison'.
Use Tableau Dashboard pane to add the worksheet and a text box for the title.
Expected Result
Dashboard shows clear monthly sales comparison with YoY percentage changes.
Final Result
Year-over-Year Sales Comparison

Month      | 2022 Sales | 2023 Sales | YoY Change %
---------------------------------------------------
January    | 18000      | 22500      | +25.0%
February   | 20500      | 22500      | +9.8%
March      | 20000      | 24500      | +22.5%

(Line chart with two colored lines for 2022 and 2023 sales, labels showing YoY % above 2023 points)
Sales increased in all three months from 2022 to 2023.
January saw the highest growth at 25%.
February growth was modest at about 10%.
March also showed strong growth of over 22%.
Bonus Challenge

Add a filter to the dashboard to allow users to select a specific Region and see the year-over-year comparison for that region only.

Show Hint
Use a Region filter on the dashboard and apply it to the sales worksheet.