Complete the code to calculate a 3-period moving average using Tableau's WINDOW_AVG function.
WINDOW_AVG(SUM([Sales]), -2, [1])
The WINDOW_AVG function calculates the average over a range of data points. The second argument is the start offset, and the third argument is the end offset. For a 3-period moving average, the window includes the current row and the two previous rows, so the end offset is 0.
Complete the code to calculate a 5-period moving average including the current and previous 4 periods.
WINDOW_AVG(SUM([Profit]), [1], 0)
For a 5-period moving average including the current and previous 4 periods, the start offset is -4 and the end offset is 0.
Fix the error in the moving average calculation to correctly compute a 7-day moving average.
WINDOW_AVG(SUM([Quantity]), [1], 0)
A 7-day moving average includes the current day and previous 6 days, so the start offset should be -6.
Fill both blanks to calculate a centered 3-period moving average (one previous, current, and one next period).
WINDOW_AVG(SUM([Revenue]), [1], [2])
A centered 3-period moving average includes one previous period (-1), the current period (0), and one next period (1).
Fill all three blanks to calculate a moving average of [Sales] over the last 4 periods excluding the current period.
WINDOW_AVG(SUM([1]), [2], [3])
To calculate the moving average over the last 4 periods excluding the current, use SUM([Sales]) with start offset -4 and end offset -1.