0
0
Tableaubi_tool~5 mins

Rolling period calculations in Tableau - Step-by-Step Guide

Choose your learning style9 modes available
Introduction
Rolling period calculations help you see trends over time by averaging or summing values for a set number of past periods. This smooths out ups and downs and shows clearer patterns in your data.
When you want to show the average sales of the last 3 months on a monthly sales chart.
When you need to display the total revenue for the past 7 days on a daily dashboard.
When your manager asks for a 12-month moving average to understand yearly trends.
When you want to compare current week performance against the average of previous weeks.
When you want to smooth out daily website visits to see overall traffic trends.
Steps
Step 1: Open your Tableau workbook
- Tableau Desktop main window
Your data and worksheets are visible
Step 2: Create a calculated field
- Analysis menu > Create Calculated Field
A dialog box opens to enter the formula
Step 3: Type the rolling calculation formula
- Calculated Field dialog
Formula is ready to use in your view
💡 For a 3-month rolling sum, use: WINDOW_SUM(SUM([Sales]), -2, 0)
Step 4: Click OK to save the calculated field
- Calculated Field dialog
The new field appears in the Data pane
Step 5: Drag the new calculated field to Rows or Columns shelf
- Worksheet view
The chart updates showing rolling values
Step 6: Right-click the calculated field on the shelf and select Edit Table Calculation
- Shelf context menu
Table Calculation dialog opens for configuration
Step 7: Set the calculation direction and partitioning
- Table Calculation dialog
Rolling calculation correctly computes over desired time periods
💡 Choose 'Table (Across)' for time on columns or 'Table (Down)' for time on rows
Before vs After
Before
Line chart shows monthly sales with sharp ups and downs for 12 months
After
Line chart shows smoother sales trend with 3-month rolling sum applied, reducing sharp spikes
Settings Reference
Calculation Type
📍 Table Calculation dialog
Defines the type of rolling calculation to perform
Default: Window Sum
Compute Using
📍 Table Calculation dialog
Determines the direction and scope of the rolling calculation
Default: Table (Across)
Start and End Offset
📍 Table Calculation dialog
Sets how many periods before and after the current row to include
Default: Start: -2, End: 0 for 3-period rolling
Common Mistakes
Not setting the correct Compute Using direction
The rolling calculation sums or averages over wrong data points, giving incorrect results
Always check and set Compute Using to match your time dimension layout (Across or Down)
Using WINDOW_SUM without offsets
Calculates sum over entire table instead of rolling window
Specify start and end offsets like WINDOW_SUM(SUM([Sales]), -2, 0) for last 3 periods
Summary
Rolling period calculations show trends by averaging or summing over past time periods.
Use Tableau's WINDOW functions with proper offsets and Compute Using settings.
Always verify the calculation direction matches your time dimension layout.