KNOWLEDGE BASE

Filter a Time Series Graph on a Two Month Unit (Or Three Week, etc)


Published: 03 Feb 2021
Last Modified Date: 04 Feb 2021

Question

How to filter data and show the time series graph as a time unit such as two-month, three-week, etc.
 

Environment

  • Tableau Desktop

Answer

1. Create a calculation field to get the start day of each month (or week)
Two-Month Unit: DATE(DATETRUNC('month',[Order Date]))
Three-week Unit: DATE(DATETRUNC('week',[Order Date]))

2. Create a parameter to choose the start day.
User-added image

3. Create a TF calculation field to filter the time series data
Two-Month Unit: [Order Date]>=DATETRUNC('month',[Two-month Unit Start Day]) AND [Order Date]<DATEADD('month',2,DATETRUNC('month',[Two-month Unit Start Day]))
Three-week Unit: [Order Date]>=DATETRUNC('week',[Three-week Unit Start Day]) AND [Order Date]<DATEADD('week',3,DATETRUNC('week',[Three-week Unit Start Day]))

Additional Information

Since the default filter only supports one month/week, a calculation field is needed to filter the data by different date rage.
Did this article resolve the issue?