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.
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.
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.
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!