Advanced Parameters in Tableau
Advanced Parameters in Tableau
What are the parameters in tableau?
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 advanced parameter contains almost 3-4 steps:
- Create parameter
- Expose the parameter control in tableau
- Use parameter in a calculated field
- Use calculated value in the view
- Create 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.
- 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 Show Parameter. It will display your parameter with values you have specified while creating it. Now we can format this legend by right click on legend to get values in drop-down or radio buttons, etc.
- 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 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 parameter.
Here your business logic is cleared which you have applied it on parameter.
- Use 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 calculated field, the parameter control will behave.
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?
- 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 Add values into the ‘List of values’ sections where add display names in ‘Display As’ section. Click ‘OK’. Here we will change the view dynamically by sales or profit.
2.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.
3. 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 parameter then axis should be changed to take sales values and if [Profit] selected then axis will take profit values and the view will get changed as per the changes.
4. Now create a view. Drag [Region] into columns shelf and calculated field [Sales or Profit] on Rows shelf.
5. 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.
To create parameterized reference lines just right click on the axis on which you want to add reference line and click on Create a new parameter
Hope you have understood the parameters in the tableau from start to end and how to build your views dynamic to get the best interactivity.