This article shows how to calculate the moving average in Tableau with an example. First, drag and drop the English Country Name to the Columns shelf and Color to the Rows shelf to do this. Next, pull the Sales amount to the Text shelf.
Next, add the row and column grand totals and format them.
How to calculate the moving average in Tableau?
Under the Marks shelf, click the down arrow beside the Sum(SalesAmount), click Quick Table Calculation, and then select Moving Average.
Now, it displays the moving average calculated across the Table. It means average for Black Color.
- Australia and Canada = ( 2930604 + 536389) / 2 = 1,733,496.5
- France = (2930604 + 536389 + 894507) / 3 = 1,453,833.33
Let me change the computing using the option from Table (across) to Table(Down). Then, Tableau calculates the moving average for each country (not Color), i.e., Table Down.
Without Quick Table Calculation
It’s a simple matrix with Year of Order Date on the Columns shelf, Quarter(OrderDate), and Month(OrderDate) on the Rows shelf. Next, add Year(OrderDate) to the Color and Sales to the text section. Then, drag Order. Date to filter shelf to remove 2010 and 2014 years.
Click the down arrow beside the Sum(SalesAmount) and select Add Table Calculation option.
First, change the Default Calculation type from Difference From option to Moving Calculation. Next, change the Summarized Value using the default Sum to Average option.
Compute using Table (down): Tableau calculates the moving average for each year (2011, 2012, and 2013).
Compute using Table (across then down): It calculates the moving average for each month (Jan 2011, Jan 2012, Jan 2013, Feb 2011, etc.).
Specific Dimensions: Choose the dimensions to calculate the moving average in Tableau.