Tableau Tips & Tricks: Using Parameters to Swap Measures or Dimensions in a View
Introduction
Have you ever wanted to use the same visual to analyze results for a different measure or dimension? Rather than creating multiple copies of the same sheet so that you have one for each measure or dimension, you can use Tableau Parameters to dynamically swap fields in a single chart. Using Parameters to select the measure or dimension in a view can greatly reduce the number of sheets in your dashboards and gives your end users more autonomy by letting them choose what results are displayed. Best of all – they are extremely easy to build!
Walkthrough
Below are the step-by-step directions for creating Parameter-based measures and dimensions. These examples use the Sample – Superstore dataset that comes packaged with Tableau Desktop.
- Use the menu in the Data pane to create a Parameter.
- Name your Parameter ‘Selected Measure’ and make the following menu selections:
- Choose which Measures you would like to include in your Parameter and order them according to your preference. We decided to use Sales, Quantity, and Profit in this example.
- Right-click the Parameter and select the ‘Show the Parameter Control’.
- Create a calculated field with CASE WHEN logic that maps each value of your Parameter to the appropriate Measure.
- Use the new Parameter-Based Measure to build your visuals.
- Use the ‘Selected Measure’ Parameter to swap the measure in the view.
- Repeat Steps 1-7 to create a ‘Selected Dimension’ Parameter.
Play around with an interactive version of this example below and feel free to download a copy of the Tableau Workbook to make your own edits!
Tableau Interactive Graph
Conclusion
Tableau Parameters are powerful tools that allow developers to reduce file sizes and end users to easily customize dashboards to their needs. The walkthrough above covers how you can use Parameters to swap fields in a view, but there are many more applications. We’ll be covering more of them in upcoming blog posts so stay tuned!
Be sure to follow Softcrylic on LinkedIn & check our website for more Tableau Tips & Tricks, more blog posts from our analytics efforts, and information about our products and services.
Tableau Interactive Graph
Conclusion
Tableau Parameters are powerful tools that allow developers to reduce file sizes and end users to easily customize dashboards to their needs. The walkthrough above covers how you can use Parameters to swap fields in a view, but there are many more applications. We’ll be covering more of them in upcoming blog posts so stay tuned!
Be sure to follow Softcrylic on LinkedIn & check our website for more Tableau Tips & Tricks, more blog posts from our analytics efforts, and information about our products and services.
Read more from our Data Visualization practice here.