Tableau Parameters and Related Concepts

What are Parameters in Tableau?

A parameter is one of the most important and a big concept in Tableau. Parameterizing is used to get excellent interactivity in your dashboards or reports.

The most important use cases for the parameter is that it allows the users to change the dimensions or measures displayed in the view.


How to create parameter control?

Creating an advanced parameter contains 3-4 steps:
1. Create a parameter
2. Expose the parameter control in Tableau
3. Use parameter in a calculated field
4. Use the calculated value in the view

1. Create a Parameter in Tableau: 

• Click on the down arrow next to the search bar in the data section or by right-clicking on blank space in dimension, measure or parameter shelf.
• Now you will get a window where you need to add specifications of the parameters like name, type, display name, etc.
• Enter the parameter name whatever you want to be displayed on the parameter legend, then define the data type. Parameters can be of type String, Number, Boolean, Date, and Datetime.
• Allowable values may contain the variable that will contain the parameter.

2. Expose the parameter control in tableau:

Parameter control can be made visible in the Tableau worksheet by just right-clicking on the parameter and then click on the Show Parameter. It will display your parameter with the values you have specified while creating it. Now we can format this legend by right click on the legend to get values in the drop-down or radio buttons, etc.

3. Use parameter in a calculated field: 

We have parameters created already, now we need to program them to work as per business requirement. So, we need to write a calculated field to write a small query to decide the behavior of your parameter.
Right-click on the blank space in the dimension/measure shelf or click on the arrow next to the search bar in the data section to create a calculated field in tableau. Now you can write the query like what you are going to display on click on a specific value of the parameter.
Here your business logic is cleared which you have applied it on parameter.

4. Use the calculated value in the view:

Drag and drop the calculated field created in step3 into your view.
Now check the view’s dimensions and measure values are changing as per the values in the parameter. As per your query written in the calculated field, the parameter control will behave.
Example:

We can use parameters to change the chart type as per requirement or we can change the axis values as per the parameter value and there are many more use cases where we can use parameters in Tableau.

How to change axis dynamically in Tableau using parameters?

A) Create a parameter just by clicking on the arrow next to the search bar in the data section with the name as “Select Sales or Profit”. Change the properties as data type as String, Allowable values as List. Add values into the ‘List of values’ section where add display names in ‘Display As’ section. Click ‘OK’. Here we will change the view dynamically by sales or profit.




B) Right-click on the parameter and click Show Parameter You will see the parameter legend getting enabled in the worksheet where you see all the values entered while creating the parameter.


C) Now create a calculated field named as ‘Sales or Profit’. The query should be written in such a way that when we select [Sales] from the parameter then the axis should be changed to take sales values and if [Profit] selected then the axis will take profit values and the view will get changed as per the changes.


D) Now create a view. Drag [Region] into columns shelf and calculated field [Sales or Profit] on Rows shelf. 


E) Now we need to change the name of the axis dynamically. For that just drag [Select Sales or Profit] parameter on the axis. You will see the axis names are also changing as we are switching between parameter values.


Several ways to create parameters in Tableau:

While creating Filter:


While creating sets: 


While creating Bins: 


Also, you can create a parameter by right-clicking on the dimension as below image:



To create parameterized reference lines just right click on the axis on which you want to add a reference line and click on Create a new parameter 


Hope you have understood the parameters in tableau from start to end and how to build your views dynamic to get the best interactivity.