Creating a Dynamic Date Field in Tableau

I want to teach you a method I’ve used with various clients when they needed a flexible date field as part of their Tableau dashboard. In one example, I was working with a company that was using Tableau to create client-facing reports. Problem is, they had different granularities of data for different clients. For some clients they collected data daily, others monthly, and some yearly. What they needed was the ability to create a flexible dropdown that allowed them to change the level of date granularity in the view.


To accomplish this, we need to create a parameter that controls date granularity, and a calculated field that inherits the values being displayed in the parameter. Let’s start with the parameter and create this:


It’s very important that the list of date parts under “Value” are all singular and lower case. We will be using them in a calculated field that requires singular, lowercase date parts. The date parts under “Display As” can be whatever you like.

Next we’ll create this calculated field:


The DATETRUNC() function displays a date at the specified date level. Usually this is static but in our case the date level will be adjustable in the parameter.

Next, we’ll pull this Dynamic Date field into the view and make sure it is set to the “Exact Date” date level.


Now we can show the parameter control and adjust the worksheet as desired.



Need more help?  Please contact us at