0
0
Tableaubi_tool~10 mins

Rolling period calculations in Tableau - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

Daily sales data for five consecutive days in January 2024.

CellValue
A1Date
B1Sales
A22024-01-01
B2100
A32024-01-02
B3150
A42024-01-03
B4200
A52024-01-04
B5130
A62024-01-05
B6170
Formula Trace
WINDOW_SUM(SUM([Sales]), -2, 0)
Step 1: SUM([Sales]) at 2024-01-01
Step 2: WINDOW_SUM(SUM([Sales]), -2, 0) at 2024-01-01
Step 3: SUM([Sales]) at 2024-01-02
Step 4: WINDOW_SUM(SUM([Sales]), -2, 0) at 2024-01-02
Step 5: SUM([Sales]) at 2024-01-03
Step 6: WINDOW_SUM(SUM([Sales]), -2, 0) at 2024-01-03
Step 7: SUM([Sales]) at 2024-01-04
Step 8: WINDOW_SUM(SUM([Sales]), -2, 0) at 2024-01-04
Step 9: SUM([Sales]) at 2024-01-05
Step 10: WINDOW_SUM(SUM([Sales]), -2, 0) at 2024-01-05
Cell Reference Map
Sales
Sales
Sales
Sales
Sales
The formula uses sales values from the current and previous two dates to calculate the rolling sum.
Result
     A          B          C
1  Date       Sales    Rolling Sum
2  2024-01-01  100         100
3  2024-01-02  150         250
4  2024-01-03  200         450
5  2024-01-04  130         480
6  2024-01-05  170         500
Column C shows the rolling sum of sales for the current day and the two previous days.
Sheet Trace Quiz - 3 Questions
Test your understanding
What is the rolling sum value on 2024-01-03?
A450
B200
C350
D300
Key Result
WINDOW_SUM(SUM([Measure]), -N, 0) calculates a rolling sum over the current and previous N rows.