KNOWLEDGE BASE

Obtain a 12 Month rolling average and display the last 12 months data only


Published: 09 Jan 2023
Last Modified Date: 10 Jan 2023

Question

How to get a 12 Months rolling average and display the last 12 months only?

Environment

 
  • Tableau Desktop all versions
  • Tableau Server all versions

Answer

Please review the following step:

1. Create a calculated field with the following code:
  
Name: Hide Month

Calculation: LOOKUP(MAX(DATETRUNC('month', [Ship Date])),0)

2. Drag the new calculated field to the Columns shelf and right-click to Compute Using > Cell.

3. Drag the calculated field to the Filters shelf and select all values. Right-click to select Continuous.

  
 

4.  Set the filter as a Relative Date filter and select the last 12 months as shown below.


 
Did this article resolve the issue?