KNOWLEDGE BASE

Creating a Date Range Filter Using Parameters


Published: 15 May 2015
Last Modified Date: 30 Aug 2016

Issue

How to make a date range filter using parameters, so that the unit (year, quarter, month) can be used in other calculations. 

Environment

Tableau Desktop

Resolution

Parameter 1: string values describing time period - value should be in lower case (year, quarter, month, week, day)
 
Parameter 2: integer range for lowest unit (1 year's worth of weeks = 52)
 
Calculation Filter: [Date] >= DATEADD([Parameter 1], -[Parameter 2], TODAY()) -> place on filter shelf and set to True
 
Example of how to call the Parameter unit into a string describing the filter:
New Date Range Calc: 'Last ' + STR([Parameter 2]) + ' ' + STR([Parameter 1]) + 's'
-> will display as "Last 2 quarters" if [Parameter 1] set to quarter and [Parameter 2] set to 2

Cause

There is currently no feature for calling the unit of measurement in the Date Range Filter in other calculations, or for customizing how the Date Range Filter is displayed.
Did this article resolve the issue?