Calculate the Moving Average in Tableau

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.

Simple Crosstab Report

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.

Calculate Moving Average in Tableau using Quick Table Calculation

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
Calculate Moving Average in Tableau compute using table across Output

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.

Calculate Moving Average in Tableau compute using 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.

Simple Matrix

Click the down arrow beside the Sum(SalesAmount) and select Add Table Calculation option.

Choose Add Table Calculation

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.

Calculate Moving Average in Tableau using Table Calculation option

Compute using Table (down): Tableau calculates the moving average for each year (2011, 2012, and 2013).

Calculate Moving Average in Tableau Table down

Compute using Table (across then down): It calculates the moving average for each month (Jan 2011, Jan 2012, Jan 2013, Feb 2011, etc.).

Compute using Table Across and then down

Specific Dimensions: Choose the dimensions to calculate the moving average in Tableau.

Calculate Moving Average in Tableau compute using Specific Dimension

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.