Dynamic Parameters in Tableau

Dynamic Parameters in Tableau is one of the most requested features of all time. Tableau’s developers have tackled individual use cases for dynamic parameters and delivered some incredible features (e.g. cross database filtering, data highlighters) to meet specific goals. However, there has not been a way to have a parameter containing a list of dimension values, that updates dynamically with the data…

…until now.

Dynamic Parameters in Tableau - unveiled

Before the reveal…

First a definition: when I refer to a dynamic parameter in Tableau, I’m specifically talking about a parameter with a list of possible values that change as the data changes (is updated, refreshed, or is filtered). And second, a bit of a disclaimer: there are quite a few pieces to creating these dynamic parameters in Tableau. It’s part hack, part work-around, and nowhere near as easy or clean as I’d like. And it only works as part of a dashboard. But it will work in cases where there is currently no other good solution. With that, let’s take a look at dynamic parameters in Tableau.

Creating your own dynamic parameters in Tableau

Yes, you’ll have to build your own… But all the pieces are finally available!

For now, you'll have to build your own dynamic parameters in Tableau
“NO! No, this one goes here, THAT one goes there…”

In addition to Tableau 2019.2 or later (which allows for parameter actions – the secret ingredient that makes it all possible), you’ll also need:

  • 1. A parameter of the correct data type with All values allowed. Don’t pre-populate it with a list of values based on the dimension you want to use. The whole point is that you don’t necessarily know what values will or won’t be available as the data changes.
A parameter in Tableau setup to allow any value for City & State.
  • 2. Another parameter called Show / Hide which is an integer restricted to either 0 or 1. We’ll use this in a bit.
Show / Hide parameter in Tableau
  • 3. A data source (in addition to the one(s) you already have) that consists of nothing more than rows of values 1 through 10. Technically, it doesn’t have to be 1 through 10, but it makes me happy.
data source in Tableau with values 1 through 10.
  • 4. A Show view that displays the current value of the parameter and will be used to trigger an action on a dashboard that will cause the currently applicable values to be displayed (more on that in a bit)
A view that will be used to show the parameter values

Using the Incrementing Data source build the view above. Show is a calculated dimension hard-coded to 1. Next Value is a calculated field with the logic:

IF [Value] == 10 THEN 1
ELSE [Value] + 1

Selected City is the parameter value, placed on Text. But the Color has been set to be completely transparent, so the text won’t show unless it’s selected.

We’ll add the action in a bit…

  • 5. A view that shows all the applicable values:
View containing the dynamic parameter values - here all the city/state combinations are displayed so they can be selected as the values of the dynamic parameter  in Tableau

The view is based on one of your data sets, the one that has the dimension you want to define the values of the parameter. Place that dimension on rows.

Hide is a calculated field hard-coded to 0 and is placed in the detail so it is available to trigger an action we’ll soon define.

Show / Hide == 1 is a calculation that shows the view when the Show / Hide parameter contains a 1 value (indicating “show”) and filters the view when the parameter contains a 0 value (indicating “hide”)

You may additionally filter or implement any logic you want to adjust the list of values to change as the data does.

  • 6. A transparent image to simulate a drop-down list. Here’s what I used:
The drop-down image that will be part of the dynamic parameter in Tableau

Putting it all together on a dashboard to complete your dynamic parameter in Tableau

Put all the ingredients together to create your dynamic parameters in Tableau
Time to put all the ingredients together

We’ll put everything together in a dashboard. Here’s a very rough example that shows how it might work:

Here are the pieces:

All the pieces together.

And here’s how it works. The transparent Show view sits on top of the transparent image which allows you to see the actual real parameter on the bottom. When you click, you’ll click the Show view which does several things:

  1. Reveals the text of the selection, which is the parameter value. This prevents the selection from hiding the value
  2. Triggers a change in parameter value to Show / Hide which causes the list of values to be seen
  3. Triggers a self-filter action so the selection will be cleared when a city is selected (that concept is a whole other blog post here)

Once the “drop-down” selection list is shown, you can make a selection. That selection does a few things:

  1. Triggers a change of parameter value to the value of the dimension in the row selected. (That updates the views, changes calculations, whatever you wanted to do with the parameter!)
  2. Triggers a change of the Show / Hide parameter causing the “drop-down” list to collapse as soon as the selection is made.

And there you have it: dynamic parameters in Tableau! Is it perfect? No way. But can it work in some circumstances when you really need it. You bet! Bon Appétit

Leave a Reply

Your email address will not be published. Required fields are marked *