In March 2019, I published my second viz to Tableau Public. I spent weeks collecting and cleaning the data, and another few weeks building out the dashboard. In theory, it was a really cool viz. Users could adjust a series of eight different parameters to look up and visualize over 4,000 unique NFL Team stats for any season, or range of seasons since 1966. Pretty cool right? I thought so too…until I finished building it.
Due to the volume of data (over 50 years’ worth of game level data) and the ridiculous number and complexity of calculations needed for all of the different stats, the performance was not great. Overall, it took about 10 seconds to load, which normally would not be an issue, but when it takes that long to load between every parameter selection the load times start to add up. The viz was designed so that users could look up very specific stats, which means they could potentially be changing all eight parameters. 8 parameters x 10 second load time is a minimum of a minute and twenty seconds, not accounting for any time needed to review and select the parameters. Here is an example of what that looks like (video is 2x actual speed):
In the example above, I am trying to figure out, for the 49ers between 1980 and 2000, in what regular season game did they combine with their opponent for the fewest rushing yards? The answer…October 14, 1990 the 49ers combined with the Atlanta Falcons for a total of just 79 rushing yards. The problem…it took 1 minute and 52 seconds to get that answer, and most of that time was spent waiting for the dashboard to load between parameter selections.
At the time I did not have many options. I had done all of the performance optimization that I could, but I just could not get that load time between parameter selections down any further. So I published it and walked away defeated and disappointed. After spending over a month collecting and cleaning data, and building out the viz, I didn’t even want to use it, so I certainly couldn’t expert others to.
A few months later Parameter Actions were introduced. I was really excited about the incredible possibilities that this new functionality opened up, but it didn’t occur to me that I could leverage them to fix my NFL Stat Generator viz…that epiphany came a little while later. But once it hit I immediately opened my forlorn dashboard, and within half an hour I had the viz that I set out to build so many months earlier. In this revised version I used Parameter Actions to basically “hand off” values from dummy parameters in the view, to the actual parameters that fed the calculations and visualizations, when the action was initiated. The dummy parameters would basically just hold the selected values but no updates would be made to any of the calculations or to the viz…so no load time. Then once the Parameter Action is initiated by clicking on a button, all of those selected values are passed to the real parameters. This allowed users to adjust as many parameters as they wanted to, click a button when they’re finished, and have the viz load just once. Here’s an example of what the revised version looked like (video is 2x actual speed);
The revised version allowed users to look up specific stats in less than 30 seconds, and the majority of that time was spent reviewing and selecting the parameters. That’s about a 75% improvement. To accomplish this I needed to first, prevent Tableau from rendering in between parameter selections, and second, force it render once all of the selections were made.
Creating the “Apply” button
Step 1: Build all of the parameters and calculations needed for your dashboard
Step 2: Duplicate each of your parameters and add ” – View” to the name of the duplicates
Step 3: Replace all of the parameters in your dashboard with the duplicate versions (ending with ” – View”)
Step 4: Create a new worksheet called “Apply Parameters”
Step 5: Create a calculated field called “Apply” with just “” in the calculation body
Step 6: Create the “Apply” button
- Drag the “Apply” field to the Detail Shelf
- Change the Mark Type to Square
- Increase the Size of the mark as large as you can
- Edit the Label to say “Apply” or whatever else you would like to be shown and edit the font appropriately
- Edit the Color of the square as desired
- Set the Worksheet Color to the same color as the square
- Drag each of the duplicate parameters (ending with ” – View”) to the Detail Shelf
Step 7: Add the “Apply Parameter” worksheet to your dashboard
Adding the Parameter Action
Step 1: Create a Dashboard Parameter Action for your first Parameter
Step 2: Update Parameter options
- Under Source Sheets, select the “Apply Parameter” worksheet
- Under Target Parameter, select the original Parameter that was built (the one referenced in your calculations)
- Under Field, select the duplicate version of the Parameter (the one ending with ” – View”)
- Under Aggregation, select “None”
Step 3: Repeat for all Parameters
This example uses a Square for the Apply Parameter worksheet, but there are other options as well. Here is an example where a custom shape was built in Powerpoint and then added to the dashboard.
And here’s another example where you can click on my face to update the dashboard
Alright, you probably don’t want to use that one, but the point here is that you have a lot of options when it comes to your Apply button. So there it is. A really simple trick that can result in significant performance improvements when your dashboard has several parameters.