Filtering Date Fields in Tableau Using Parameters

Data

Filtering Date Fields in Tableau Using Parameters

Until recently, whenever I needed to filter data by date, I would use a quick filter and adjust the filter using one of the pre-determined controls (Single/Multiple Value(s) selectors). Where was the option for a drop-down calendar like you would see when you’re trying to book a flight? As it turns out, Tableau does have such an option. It’s quite easy to get it!

Note: If we want to filter our data over a range of dates, we will have to create two filters – one for the start date and the other for the end date.

Step 1: 

Let’s create a new parameter by right-clicking an empty area of the Data shelf and selecting Create Parameter.

Create Parameter

Step 2: 

In the Parameter window, change Name to “Start Date” and Data Type to Date. You can also use Date & Time, but we will stick with Date for this blog post. Current value can be set to whatever you want. For our purposes, we will leave today’s date. For Display format, we will select Automatic. For Allowable values, choose the All button. Click OK.

Step 3:

Right-click the new parameter and choose Show Parameter Control. A menu will pop up on the right. You can now change the date using a drop-down calendar! But wait – when you change the date, your viz doesn’t change! What gives?! We still have the tiny matter of creating the calculated field to complete the filter.

Step 4: 

From the Data shelf, right-click the parameter we just created and select Create Calculated Field. Here, we will filter which dates we are interested in by using the calculation in the image below.  

Calculated Field Filtered Dates

Step 5: 

Lastly, to enable the filter, drag our new calculated field to the Filters shelf and select the True check box. If you only have a False check box, select it and the Exclude option to the right of the All and None buttons. This occurs when the parameter date is out of the range in which you’re interested. 

Start Date Filter

Follow these steps again to create the end date parameter and calculated fields. Once this is done, you can change the date filters using drop-down calendars! 

More About the Author

Nicholas Laurenti

Analytics Consultant
Extract Geological Data Directly into Tableau with Our USGS Web Data Connector As a data-driven society and Tableau junkies, connecting to your favorite data sources easier is definitely a welcome sight. Tableau ...
The 2016 Stanley Cup Playoffs Matchup Viz Many of us at InterWorks are avid sports fans, as you can see from our various blog posts and the many examples in the Viz Gallery. ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072