There are many things we suppose we cannot do in Tableau, but we always identify a solution. The same is true for parameters. In Tableau, we use parameters when, for example, we are not sure which value we want to display or when we need to create a value that is not normally found in our dataset. And while most data analysis tools allow you to build graphs and reports using only static values, Tableau offers users countless opportunities to add interactivity to the data and to the way it is displayed in final analysis. In today’s post we will discuss ways to create multiple select parameters in Tableau and we will see how we can apply these methods in our analysis.
We have discussed many times in our blog section about ways we can use parameters in Tableau, such as how to change date level using a parameter, how to create drill down tables using parameter actions and even how you can build parameters with animations. Usually, a parameter replaces in a graph or dashboard a filter, a calculation or a constant value of a reference line. Often, we choose to use parameters in Tableau when we want to add more interactivity to our analysis and more control to the end user. Thus, he will be able to choose for himself the way in which the data are displayed, but also the information he wants to be viewed.
But what can we do when, for example, we want to select several parameters that the final dashboard considers when displaying certain data? We may need to use a parameter for multiple data sources, or we simply need to select multiple levels of information for different scenarios. The answer is simple: we use multiple select parameters to display multiple data segments in the same view.
In the example below we will create a dashboard in which we will see sales value, profit and profit ratio depending on the areas where sales were recorded and depending on customers type. Thus, we will apply multiple select parameters in order to be able to view the data for several customer segments at the same time.
The video below explains all the steps you need to go through to use multiple parameter selection in Tableau. They are also mentioned below the video.
→ In Tableau Desktop, connect to Sample Superstore.
→ Create a sheet named KPIs by State.
→ Drag the Order Date on Columns and State on Rows.
→ Drag Measure Values on Text and keep only the fields: Sales, Profit and Profit Ratio.
→ Drag Measure Names from the Marks Area on Columns.
→ Add Measure Values on Colour and the right click on it and select Use Separate Legends.
→ Create string parameter with no values in the parameter for now.
→ Create a parameter named MultiParam. From the Data Type select String, for the Current Value area remove the value and from the Allowable Values select All.
→ Create a sheet named Parameter that will be used for the multi-select parameter.
→ Create a calculated field named MIN(0) with the formula:
→ Drag the field MIN(0) on Columns twice. Set one mark type to circle with 40% opacity and the other marks card to shape and use an open circle. This will give the open bubble effect above. Finally edit the axes to go from -1 to 10.
→ Drag the Segment on Rows.
→ Create a calculated field named On/Off with the formula:
→ Create a calculated field named Parameter Action with the formula:
IF CONTAINS([MultiParam], [Segment])
THEN REPLACE([MultiParam], [Segment], “”)
ELSE [MultiParam] + “, ” +[Segment]
If a member of Segment is in the MultiParam parameter then it’ll remove the value. If it’s not in the parameter then it’ll add the value to the MultiParam string.
→ Drag the field On/Off on Colour on second axis (the one with Circle), the field Parameter Action and the parameter MultiParam on Detail.
→ On the KPIs by State sheet add the calculated field On/Off on Filters area and select True.
→ Create a dashboard and add both sheets on it.
→ Create a parameter action on the dashboard.
→ Go to Dashboard -> Actions -> Change Parameter. On Source Sheets select Parameter sheet, Run action on -> Select, Target Parameter select MultiParam and for the field select param action field.
By Adelina Popescu