How to Create Multiple Select Parameters in Tableau

What are Multiple Select Parameters in Tableau?

As its name suggests, multiple select parameters allow you to select multiple parameters. It functions in the same manner as multiple select filters in Tableau. 

Currently, the challenge with existing parameters in Tableau is that only a single selection can be made. The Tableau community continues to ask for more flexibility with parameters from Tableau’s developer team, and this is a feature that may be offered in a future release of Tableau.

Similar blogs have discussed how to do this, including Marc Reid’s blog on creating a selection panel and Tableau Zen Master Hall of Famer Jonathan Drummey’s detailed post on using parameters as a data source. Both describe use cases in great detail. 

This post will differ as it offers a simplistic approach to developing multiple select parameters and more-or-less uses the same base framework. Using parameter actions and formatted sheets, we can build out multiple select parameter actions.

Use Cases for Multiple Select Parameters

Multiple select parameters offer flexibility in improving parameter functionality and design on dashboards. There are various use cases for multiple select parameters:

  1. You have to use a parameter across multiple data sources
  2. You want to create a chart legend that also acts as a selector
  3. You want to be able to select multiple levels for scenario planning
  4. You just want multiple selection parameters

How to Create Multiple Select Parameters

Step 1: Build the Visualization

Using the sample superstore data in Tableau, we will build a simple table of sales, profit, and profit ratio for states in the southern region for the year 2021. 

Step 2: Create a String Parameter with No Values

Create a new parameter in the data pane.  We will use the Segment dimension as the multiple select parameter for this tutorial, so let’s name the parameter “Segment Parameter”. Set the data type to string, leave the current value blank, and select “All” for allowable values. 

Step 3: Create Four New Calculations

These calculations will be used in our sheets.

1. //Segment TF

				
					CONTAINS([Segment Parameter], [Segment])

				
			

This calculation is a boolean (TRUE/FALSE) that will drive which segment selection is being made. The contain function looks for the segment values inside the [Segment Parameter] parameter. This calculation identifies if a member is in the parameter or not. 

2. //Segment Param Action

				
					CONTAINS([Segment Parameter], [Segment])
THEN REPLACE([Segment Parameter], [Segment]) + ",","")
ELSE [Segment Parameter] + [Segment]) + ","
END

				
			

This calculation will be applied to the parameter action used on our dashboard later. If a member of [Segment] is in the [Segment Parameter] parameter, then it will remove the value. If it is not in the parameter, it will add the value to the [Segment Parameter] string. It will also drive the selection/deselection of parameters on the dashboard.

3. //TRUE

				
					TRUE

				
			

4. //FALSE

				
					FALSE

				
			

Step 4: Create a New Sheet

This new sheet will be used to build out the parameter selection list.

  1. Create a new sheet and rename it to something like “Parameter Sheet” or “Segment List”
  2. Drag [Segment] onto the rows shelf
  3. Drag [Segment TF] that we created in step 3, onto the colors mark
  4. Drag [Segment] onto the text mark
  5. Drag [Segment Parameter], [Segment Param Action], [TRUE], and [FALSE] fields onto the details mark

Step 5: Format the Parameter List

  • Create a new field called MIN and drag it onto the columns shelf, or you can create an in-line/ad-hoc calculation onto the columns shelf by entering min(0.0)

Or:

  • Set the marks type to circle
    • Change the color to white
    • Add a black border
  • Resize the chart
  • Hide the headers
  • Edit the axis and set it to fixed start at -0.5 and fixed end at 2
  • Remove the grid lines 

Step 6: Add the Calculation from Step 3 onto the Visualization Sheet

By adding the [Segment TF] calculation from step 3 onto the visualization sheet, this will ensure the multiple select parameter action properly filters the visualization on the dashboard. 

Note: If the visualization disappears after you put  [Segment TF] onto the filters shelf and there is no “True” selection option, open up the Segment Parameter created in step 2 and type in one of the segment options, such as “Consumer.” Then go back to the  [Segment TF]  to edit the filters and select “True.”

Step 7: Create the Dashboard

Add both sheets we created onto a single dashboard.

Step 8: Add Parameter Action onto the Dashboard

Step 9: Create a Filter Action to Automatically Deselect the Slider after a Click

This technique automatically deselects text. You can read more about this here. This is where the two fields we created, [TRUE] and [FALSE], come in handy. These two fields should already be on the details mark for the parameter sheet if it isn’t already.

Final Result

…And voila! You should now have a dashboard with multiple select parameters. 

Takeaways

Multi-select parameters are a must for Tableau. They aren’t out of the box, but anyone can build them with sheets and parameter actions. Additionally, you don’t have to use dimensions in your data; you could specify values that are external. 

There is at least one drawback to this method regarding the CONTAINS() function: if you had two members where one member was nested within the other, like “Home” in “Home Goods,” then you’d multi-select two values given the nature of contains. 

The easy way to fix that is to include a comma in your string values so that your new [param action] calculation would be:

				
					// param action
IF CONTAINS([MultiParam], [Segment] + ",")
THEN REPLACE([MultiParam], [Segment] + ",", "")
ELSE [MultiParam] +[Segment] + ","
END

				
			

Beyond that, we hope this enhances your visualizations and gets your users exactly what they need! Interested in learning more about the data visualization tools in Tableau? Reach out to our team of Tableau experts today to have all your questions answered!

Comments are closed.