0
0
Tableaubi_tool~15 mins

Rolling period calculations 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 the 3-month rolling sales totals to understand recent sales trends better.
📊 Data: You have monthly sales data for the past year, including the month and total sales amount.
🎯 Deliverable: Create a Tableau line chart showing monthly sales and a 3-month rolling total sales line to compare trends.
Progress0 / 5 steps
Sample Data
MonthSales
2023-011000
2023-021200
2023-031100
2023-041300
2023-051250
2023-061400
2023-071500
2023-081600
2023-091550
2023-101650
2023-111700
2023-121800
1
Step 1: Connect your sales data to Tableau and load the data source.
Import the data table with columns 'Month' and 'Sales'.
Expected Result
Data is available in Tableau with 12 rows representing each month.
2
Step 2: Create a calculated field for the 3-month rolling sales total.
WINDOW_SUM(SUM([Sales]), -2, 0)
Expected Result
A new field that sums sales for the current month and previous two months.
3
Step 3: Build a line chart with 'Month' on the Columns shelf and 'Sales' on the Rows shelf.
Drag 'Month' to Columns, drag 'Sales' to Rows.
Expected Result
A line chart showing monthly sales values.
4
Step 4: Add the 3-month rolling sales calculated field to the Rows shelf to overlay on the chart.
Drag the calculated field '3-month Rolling Sales' to Rows next to 'Sales'.
Expected Result
The chart shows two lines: monthly sales and 3-month rolling sales totals.
5
Step 5: Format the chart for clarity: add labels, legend, and title.
Add chart title 'Monthly Sales and 3-Month Rolling Total', enable data labels, and add legend.
Expected Result
Clear, easy-to-read chart comparing monthly sales and rolling totals.
Final Result
Month: 2023-01 to 2023-12

Sales  |      *       *       *       *       *       *       *       *       *       *       *       *
       |     * *     * *     * *     * *     * *     * *     * *     * *     * *     * *     * *     * *
       |    *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
       +---------------------------------------------------------------------------------------------->
        2023-01 2023-03 2023-06 2023-09 2023-12

Legend:
* Single star line = Monthly Sales
* Double star line = 3-Month Rolling Sales Total
The 3-month rolling total smooths out monthly fluctuations and shows clearer sales trends.
Sales generally increased over the year with some seasonal dips visible in monthly sales.
Rolling totals help identify sustained growth periods better than single month values.
Bonus Challenge

Create a 6-month rolling average sales calculation and add it as a third line on the chart.

Show Hint
Use WINDOW_AVG(SUM([Sales]), -5, 0) as the calculated field for the 6-month rolling average.