Today is the Joy of Six day. Tableau v6 is incredible, and I’ve been lucky to have had my hands on the beta versions for a while. The Tableau site itself is a great resource for learning about the amazing new features and how to use them. I wanted to do a series of posts about how these new features are already being practically applied to solve our own real world problems.
A common problem we see is that we build a view for a user, only to have them say, “Hey, that’s great, but instead of Profit, can you show Sales? Oh, and also, I’d like to see it broken down by Container, not State”. In the old days (pre v6) you had to build a view for each request. Not now. Oh no. Not now. Now you can build in masses more flexibility into your views.
The dashboard below shows an example using Tableau’s sample data:
How do we do this trick? First let’s look at the pills that build this view.
Instead of using the actual dimensions or measures, each pill is either a parameter, eg “Choose columns”, or a calculated field based on a parameter, eg “Chosen column dim”.
There are four parameters in this view (for more on Parameters, check out this video on Tableau’s own site):
Each of these is a String List, looking something like this:
Each item in the List of values box should be a Dimension (in the above image) or a Measure (not shown) you want to the user to be able to choose. You need a parameter for each user-editable area of the worksheet. In my example, that’s a parameter for Row, Colum, Bar length, and Colour.
Once you have your parameters, show them all on the worksheet (right-click on the Parameter name and choose Show parameter control).
Our next step is to connect some calculated fields to each parameter. The “Bar” calculated field looks like this:
The IF statement returns a different Measure, depending on the value of the Parameter. There are four calculated fields – one for each parameter. I created the following for the viz above:
- Chosen row dim
- Chosen column dim
Now you can build your view – drop the calculated fields onto the relevant shelf, and you should now have a dynamic view where the user gets to choose what they want to see.
The final thing you should do is format the tooltips, as the default ones will make no sense. See my previous posts on tooltips for some tips.
Download the workbook to explore how it’s done in more detail.