Tableau is a powerful data visualization tool that enables users to create insightful dashboards and interactive reports. There are a lot of times that we would like to show the highlighted group with dynamic values that the users can manipulate. This article is going to focus on how we could achieve this with parameter function in Tableau.

What are Parameters?

Parameters in Tableau are dynamic inputs that users can define and manipulate to control various aspects of their visualizations. They act as placeholders for values that can be changed by the user, such as selecting a specific dimension, adjusting a range of values, or toggling between different measures. Parameters empower your audience to explore the data on their own terms.

Reference lines

Reference lines in Tableau are a valuable tool that allow users to add context and benchmarks to their visualizations. By defining a reference line, users can visually compare data points against a fixed value or a calculated measure. Thus, a good combination of reference lines and parameters can create a powerful and straightforward focus on the data visualization. Let’s build it together with the sample superstore dataset!

First, let’s build the following view by adding SUM([Sales]) to Columns, SUM([Profit]) to Rows, [Region] to Color, and [Product Name] to Detail.

Cool! Now let’s create two parameters as the thresholds Sales and Profit Value that users can control.

  1. In the data pane, right-click anywhere and select “Create Parameter.”
  2. In the Create Parameter dialog box, give your parameter a name that clearly describes its purpose, let’s put in “Sales Threshold” for this one.
  3. Choose the data type for your parameter. (Tableau offers several options, including string, integer, float, date, and boolean.) Here we select “Integer”.
  4. Specify the allowable values for the parameter. You can choose between a range of values, a list of predefined values, or a computed list based on a field from your data source. Here we choose “All” and Press “OK”.
  5. Click “OK” to create the parameter. It will now appear in the data pane. Right click on the created parameter and select “Show Parameter” to display it to change values.
  6. Repeat step 2-6 to built “Profit Threshold” Parameter.

Now that we have built our parameters, where users can change values. It’s time to build our reference lines and link them to the parameters, so the parameters can define the values for reference lines or bands, enabling users to adjust benchmarks or target values on the fly.

  1. Right click on the X-axis (Sales) and select “Add Reference Line”
  2. In the Pop-Up window, in the value box, select the “Sales Threshold” parameter that we just created and change the Label to “Value” to show the number in the view. Click “OK’ to confirm.
  3. For the Y-axis (Profit), repeat the steps to create threshold reference line for profit.
  4. Now you have two threshold reference lines in your view, try type in a number in the parameter box and the value and position of that reference line should change correspondently.

What a great achievement! But we’re not done yet! We would also like to highlight the “High Sales and High Profit” group where both the products’ sales and profits exceed their threshold! (If you want to see how to highlight the target group, please move to my previous blog:…ynamic-threshold/). Let’s get make the calculation together!

  1. In the data pane, click on the triangle beside the search bar and select “Create Calculated Field”.
  2. In the Pop Up window, give the calculation a name that indicates its purpose, here we use “High Sales & High Profit Group”; and the calculation indicates that the target group should have its sales greater than the sales threshold and it profit greater than the profit threshold, as is shown in the picture below. Click “OK”.
  3. Now you can see the calculation shown in the data pane, drag it on the color card and press “Edit Color” to choose the color palette you like.
  4. Now you should see the target group being highlighted, and the group will change dynamically with the parameter value.

Hope everyone enjoys Tableau Parameter so far! And if you would like to go one step further, and add in [Region] for the colour legend, follow me through the steps below.

  1. Drag [Region] in the Marks Pane and it will show up as “Detail”.
  2. Click the Detail symbol at the front and change it to colour.
  3. Press “Edit Colour” and configure the colours to your preferred palette (all the false group can be the same colour).

Now you can see the target group being highlighted with the regional colour legend.

The Data School
Author: The Data School