tldr: here’s the workbook if you can’t wait to break it apart and don’t care for reading tutorials
Tableau 2019.2 brings with it an amazing new featured called Parameter Actions. For me it’s without a doubt one of the best new features in a long time and one that allows for some amazing new things in Tableau as well as some great time savers and better user experience in Tableau. What are Parameter Actions? Filippos Lymperopoulos has a nice explanation.
Parameters in Tableau are constant values. Constants are key components in many analytics scenarios. They can be used in calculations, act as references in table calculations, and define analytic indicators (like reference lines and bands). You can also use them to quantitatively filter within a single data source or across multiple data sources, optimize live connection queries, and more. Parameter actions add interactivity to all of these scenarios. FILIPPOS LYMPEROPOULOS PRODUCT MANAGER, TABLEAU
A couple months ago I had the chance to present on Think Data Thursday and below is the video covering some of my own use cases in using Parameter Actions. If you prefer step by step instructions, read on.
Think Data Thursday
Click any of the links below to take you to the relevant example.
Running total start date
Imagine you have a running total that you want to allow your users to select the starting point by interacting with the viz. Prior to Parameter Actions the way to do this would be to give your user a parameter to select from. Now you can create a way to pass the starting value dynamically to the parameter and that way drive the chart. See a gif example below.
Running total start date
Create a time line by adding month (date value) of Order Date to columns and make it discrete
Add Sales to the colour and label and change the mark type to square. This is your timeline and also the view that will drive your running total.
Create Running total by adding month (date value) of Order Date to columns
Sales to the rows
Right-click the sales item in rows and add a table calculation (Running Total)
Add Category to colour
Combine both views in a dashboard.
Now for the magic sauce, we will need to create a parameter and as you will see in a lot of my use cases, the parameter itself will be super simple. This parameter will be just a date which we will then use to create a starting point for our running total.
Start Date Parameter
In the dashboard we can now apply the Parameter Action that will provide the user the ability the way to start the running total at a different point in time.
Now click on a date in the timeline view and it will filter your running total.
Sort it with 1 click
Sorting in Tableau has improved a lot in recent years but I still come across times where I just want to click one data point and filter. For those times the best solution is to use Parameter Actions. See example below.
Sort it with 1 click
Add your dimension to the rows
Your measures to the columns
In my example I’m using Measure Names/Values which have been notoriously difficult to sort.
Sort it in Measure Names/Values
Next we need to create a parameter:
Create the calculated field that will your parameter, in this we will use a Case statement.
The secret sauce on this one can be found on the Sort of our cities. We sort the Cities by the calculated field previously created. I called mine Sort
Create a Dashboard with this view and we just need to add a Parameter Action.
That’s it, now you can click on the header or a data point within the chart and it will sort by that measure. Simple right!
This is a favourite of mine. I have been asked so many times for a feature in Tableau that would allow me to scroll two views at once side by side. I’m glad Parameter Actions allow us to do this. in my example I choose to compare the top customers by Sales in 1 view and the top customers by Discount %. The idea was to see if the person that we discount to the most is also one of those who buy the most from us.
Create the views
Sales and Discount % to columns respectively
Customers to rows
I also added an index calculation to illustrate the sorting but this is optional.
Add the views side by same in a dashboard
The filter control is simple to create as well:
Create a new view and add customer to detail
Create a calculated field which is Index() and bring to rows and revert the order.
Add Index to colour (optional)
Make sure all Index fields are computing by table down and hide the axis.
For the interesting bit. Create an Integer Parameter.
Create a calculated field where the parameter is less or equal to your Index() field
Add that to both views initially created and select true. Don’t forget your compute by.
Time to combine everything in one dashboard. You’ll notice that in the image below I’ve hidden the views scroll bars. I used a floating element to do that.
Final step is to use a Parameter Action to drive the scrolling.
In my example I kept the tooltip but again that’s not really necessary.
The next example allows you to use Parameter Actions to drill-down a category. Again a simple but in my opinion a very useful way of bringing more interactivity to your dashboards.
Create a view by adding sales to columns
Category to rows
Create a String Parameter, doesn’t really matter what you have as a default value
Create a calculated field like the one below and add to your Rows, hide the headers for the category field you have there already.
This next step is optional, you don’t need different colours for Category and Subcategory, but if you want just create the calculated field below and add it to Colour on your marks card.
Add the view to a dashboard and the cherry on top is just a simple Parameter Action like the one below.
You are ready to drill-down on those categories and give that interactivity to your users.
Sync Reference Lines
The next example is again really simple, but useful. Using parameter actions to provide context in multiple charts by syncing reference lines.
Create two separate views
Add reference lines to both
Add them to a dashboard
We are going to need a parameter that passes a value to our reference lines.
Once you have that you just need to change the value being used in the reference lines.
Finally add your Parameter Action in the dashboard and you have your Reference lines synced
My example above uses a calculated field to change colour but that’s optional.
Sync Reference Lines
The final example uses some of the things we’ve done before.
Before or after
Create a timeline like the one above.
A second view with Sales in Rows
Combine them in a dashboard
The parameter to be used is just a Date parameter like the one below. Again doesn’t matter what default value you have.
In order to colour the Sales bar differently depending on the date chosen you will need a calculated field. I also used this calculated field as a Label to avoid writing a second one
The Parameter Action in this case will target the date parameter
That’s it, we used the same techniques from before to provide the interactivity needed.
If case that your reference line breaks your time line here’s the calculation you need. That’s because not aggregating the view will result in a dimension with two columns whereas aggregating it with ATTR results in a continuous field that allows your lines to be connected.
That’s it!!! 6 examples to use Parameter Actions and give the users of your dashboards lots of new interactivity options.
Let me know if you have any questions or feedback
Thanks for reading