Advance with Assist shares quick solutions to common challenges encountered by the InterWorks Assist on-demand team.
Question:
“I added a calculation that uses a parameter input and my dashboard is a lot slower now. How can I make it faster?”
Example Calculation
Some common reasons to include user-selected values (parameters) inside of calculations are:
- Change the measure displayed
- Set a date for comparison to current values
- Find points within a certain distance from a user-selected location
Let’s take a closer look at two ways you could create a calculated field to swap metrics based on a parameter value. One of these methods will be slower than the other. The difference will be more noticeable as the number of records increases.
The slower-performing method looks something like this:
High-Performance Solution
The calculation above is very simple, and using those measures individually performs quickly, even on larger datasets. Why would it be slower when introducing this logic? The explanation comes down to the difference between row-level values, aggregated values and the order of operations.
In our example, the measures are not aggregated before they are compared with the parameter. Therefore, Tableau must perform that comparison for every single record in the data source before summarizing anything.
The way to speed it up is to change the order of operations. Make sure Tableau summarizes values before checking against user selection, like this:
Now that conditional logic is evaluating summary-level data, things will be much faster. This won’t work for every situation because it depends on the level of detail used in the view. If the parameter comparison must be done before aggregating measures, the way to optimize performance is to pre-compute as much as possible in the database.