Our Blog

From time to time I get the privilege of interviewing a candidate for a business intelligence position, usually when the person has rated themselves extremely high on Tableau skills. One of, if not the first, items I investigate is advanced knowledge in parameters.

One of the biggest reasons for this relates back to my personal Tableau education. The time when it all clicked, when I finally “got it”, was when I learned the power of parameters. If the candidate can prove to me that they understand some basic functionality with parameters, I know have a feel for how Tableau works as a whole. Similarly, if I am helping bring an existing employee up to speed in Tableau, I never see their eyes light up as big as when we start teaching parameters: dimension swapping, measure swapping, dynamic colors/titles/shapes/etc!

That being said, I wanted to take some time and produce a guide to Tableau parameters. Before we start, I have to give credit to Tableau Zen Master Peter Gilks for laying an amazing framework to functionality guides. His blog post on dashboard actions is an amazing piece of work, and you should read it right after this. So… sorry Peter, I am stealing your layout and please take all the credit!

What is a Parameter?

A parameter is an element of a Tableau workbook that is used for: extending calculations, highlighting data, filtering data, reference marks, hiding and showing sheets, and so much more. There are six types of parameters:

  • Float
  • Integer
  • String
  • Boolean
  • Date
  • Date & Time

The rest of this post assumes a basic understanding of Tableau parameters, but if a refresher is needed, Tableau provides a nice overview of parameter use here: https://onlinehelp.tableau.com/current/pro/online/mac/en-us/parameters.html. All of what I am going to type has been disparately documented or written about before, but I am hoping have it all in one place will prove to be valuable. Here are the user stories we are going to cover, all of which I use daily in my professional life:

  • User Story 1: Dynamic display of a dimension
  • User Story 2: Dynamic display of a measure
  • User Story 3: Dynamic aggregation of a dynamic measure
  • User Story 4: Leveraging multiple dynamic dimensions and measures

User Story 1: Dynamic display of a dimension

“As a user, I would like the ability to change which dimension is displayed on-the-fly, without having to go to another view/chart.”

More times than not, my professional work involves building Tableau dashboards that are exploratory in nature. Being able to swap out a dimension in order to quickly gain a different perspective is a critical, and heavily-used function of an exploratory dashboard.

How to:

  • Create a new parameter and name it how you would like. For this example, we created a parameter named p.Dimension1.
  • Also note that our parameter data type is float. This example would work using float, integer, or string, but I find that float or integer makes creating calculated fields a much quicker process.
  • Choose List from the Allowable Values options
  • Begin assigning values and display as values to the list of parameter options
  • See the finished parameter below
    • Note the first value of 0 – we will use this give the user instruction and also as a way to see data in total, disregarding all other dimensions

ParamsDynDim

  • Now that we have created a parameter, we need to build a calculated field. Parameter have no use on their own.
  • Right-click your newly created parameter and select Create>Calculated Field
  • This is the part where we inject the parameter in a calculation, and use it to swap through different dimensions based on the user’s selection

ParamsDynDim2

  • For this example, I used every dimension from the Superstore data set as a possible option to select.
    • Notice that you will have to do some data type conversions to build a valid calculated field.
  • For those not familiar with the syntax, it reads like this: “Look at the option the user has selected from p.Dimension1 > Find that option in the calculated field’s CASE statement > Return the matching field to the view for display”

User Story 2: Dynamic display of a measure

“As a user, I would like the ability to change which measure is displayed on-the-fly, without having to go to another view/chart.”

As with user story 1, being able to swap out measures is equally critical to building a successful exploratory dashboard. The instructions below will closely follow the instructions from user story 1.

How to:

  • Create a new parameter and name it how you would like. For this example, we created a parameter named p.Measure (Non-Agg).
    • We appended (Non-Agg) to the end of our parameter name, because in this case we will be switching measures at the row-level, not the aggregated level.
    • The name of the parameter has no function, it is simply for reference.
  • Also note that our parameter data type is float. This example would work using float, integer, or string, but I find that float or integer makes creating calculated fields a much quicker process.
  • Choose List from the Allowable Values options
  • Begin assigning values and display as values to the list of parameter options
  • See the finished parameter below

ParamsDynMeasure

  • Now that we have created a parameter, we need to build a calculated field. Parameter have no use on their own.
  • Right-click your newly created parameter and select Create>Calculated Field
  • This is the part where we inject the parameter in a calculation, and use it to swap through different measures based on the user’s selection

ParamsDynMeasure2

  • For this example, I used every dimension from the Superstore data set as a possible option to select.
    • Notice that you will have to do some data type conversions to build a valid calculated field.
  • For those not familiar with the syntax, it reads like this: “Look at the option the user has selected from p.Dimension1 > Find that option in the calculated field’s CASE statement > Return the matching field to the view for display”

User Story 3: Dynamic aggregation of a dynamic measure

“Wow, I really appreciate the ability to swap dimensions and measures, but what I really need alongside this functionality is the ability to control the level aggregation of my dynamic measure.”

We can’t always assume how our users want to aggregate their measures. In order to further expand on our exploratory capabilities, we are going to give the user another parameter control with a list of aggregation types. We will inject the user’s selection into our row-level dynamic measure from User Story 2, which will give the user control over which measure is displayed and how it is calculated.

How to:

  • Create a new parameter and name it how you would like. For this example, we created a parameter named p.Aggregation.
    • The name of the parameter has no function, it is simply for reference.
  • Also note that our parameter data type is string. This example would work using float, integer, or string, but our calculation will be easier to read if we declare our parameter values in the same way Tableau declares aggregations.
  • Choose List from the Allowable Values options
  • Begin assigning values and display as values to the list of parameter options
  • See the finished parameter below

ParamsDynAgg

  • Now that we have created a parameter, we need to build a calculated field. Parameter have no use on their own.
  • Right-click your newly created parameter and select Create>Calculated Field
  • This is the part where we inject the parameter in a calculation, and use it to swap through different measures based on the user’s selection

ParamsDynAgg2

  • By this point, the syntax used should be fairly familiar.
    • Notice at this point we are two levels deep in parameter controlled calculations.
  • For those not familiar with the syntax, it reads like this: “Look at the option the user has selected from p.Aggregation > Find that option in the calculated field’s CASE statement > Do the appropriate aggregation on Dynamic Measure (Non-Agg) > Return the matching field to the view for display”

User Story 4: Leveraging multiple dynamic dimensions and measures

“I’m starting to see the magic of parameters, so would it be possible to have my own analytic sanbox? Maybe something like a scatter plot that I have complete control over.”

We have now created a: dynamic dimension, dynamic measure, and dynamic aggregation of said measure. With a little duplication effort, we can give our users complete power to dynamically control the: X-Axis, Y-Axis, Color, Size and Shape of their data. Every time I have deployed a solution such as this one, the response has been fantastic, and it seems to become the point where many people truly see the potential of Tableau.

How to:

  • Make 3 additional copies of p.Measure (Non-Agg)
  • Make 3 additional copies of p.Aggregation
  • Make 3 additional copies of Dynamic Measure (Non-Agg)
  • Make 3 additional copies of Dynamic Measure (Agg)
  • Within the additional copies of Dynamic Measure (Non-Agg), ensure that the calculation is pointing at the newly created parameters
  • Within the additional copies of Dynamic Measure (Agg), ensure that the calculation is pointing at the newly created Dynamic Measure (Non-Agg) fields
  • Basically, we are replication user story 2 and user story 3
  • Place one Dynamic Measure (Agg) on columns
  • Another on rows
  • Another of size
  • Another on color
  • Place Dynamic Dimension on detail
  • Show the appropriate parameter controls and organize in a sensible fashion

After some tweaks to color, size, and the like.. you should end up with something like this:

ParamsDynAll

This concludes our adventure into parameters, and I truly hope that it had some value. For many, these concepts are simple and second nature, but I hope for some that this post will open your brain to new possibilities and lead to the creation of more engaging dashboards! Who says parameters aren’t dynamic?