Parameters in Tableau
Parameters are place holders of values in Tableau. A parameter can be text, an integer, or a range of values. It helps in replacing values in calculations, filters, and the reference line. When you want to input something to your report that is not present in your data, you can pass it through parameters.
For example, when you are creating a sales report, and you want to control the view by the sale amount, you can use a parameter in the calculation. So when you want to look at the sales that are below 10000, you can pass that value to the parameter. Or, if you want to look at the sales above 50000, you change the value of the parameter dynamically.
You can also set a dynamic parameter that changes automatically based on the data source. You can use the parameters in Parameter Actions to make your reports more interactive and dynamic. So the viewers can change the parameter value when they interact with the report, i.e., a viz. This helps the viewers to choose how they want to view the report.
Take your career to next level in Tableau with HKR.Join Tableau Training now.
Creating a parameter
Open Tableau Desktop and navigate to the Data Pane. Click on the drop-down arrow in the top right corner and choose 'Create Parameter'. You will get a parameter dialog box, give a name for the parameter you want to create. Choose a data type from the drop-down. If you want to set the current value to the parameter, mention it in the 'Current Value' field.
Choose the 'Current Value' option from the drop-down for the 'Value when the workbook opens' field. Choose 'Automatic' from the drop-down for the 'Display Format' field. The next option is for specifying how the parameter allows values. It has the below options for the 'Allowable Values' field to choose from.
- All - Text field.
- List - Provides a list of values to choose from.
- Range - Set a specific range.
These options will depend on the data type that you selected for the parameter. If you choose a list, then you have to provide a list of values. You can directly start adding the values for the list, or you can add them through the 'Add values from' option. If you choose the range option, you have to specify the minimum, maximum, and step size. Once you fill all the details, click on 'Ok'. You can view the created parameter in the Parameters section at the bottom of the Data Pane.
Editing a parameter
Go to the Data pane, where you can view all the available parameters. Right-click on the parameter that you want to modify and choose the 'Edit' option. Select the 'Edit Parameter' option from the control menu. You will get an 'Edit Parameter' dialog box where you can modify the fields that you wish. Once all the changes are done, click on 'Ok' to save. The parameter will get updated wherever it is in use.
Tableau Certification Training
- Master Your Craft
- Lifetime LMS & Faculty Access
- 24/7 online expert support
- Real-world & Project Based Learning
Points to remember for parameter refresh
Here are a few cases where the parameter value or a refreshable list of values won't refresh.
- The default field returns a data type that is different from the data type of the parameter.
- The default field returns multiple values.
- The default field returns null.
- The default field refers to the data source, which is not connected yet.
- The default field is deleted from the workbook's namespace.
When Tableau encounters any of the above scenarios, it will keep the latest value for the 'Current Value' field.
Using parameters in calculations
You can use parameters in calculations so that you don't have to edit the calculations every time you want to modify something. When you want to change the value, you can go to the parameter available in the Data pane and edit it. It helps in dynamically changing the values in calculations. While writing a calculation in the calculation editor, drag the parameter that you want to use, and drop it into the calculation editor. Click on 'Ok' to finish.
Click here to get latest Tableau Interview Questions and Answers for 2024
Using parameters in filters
In a filter, you can use parameters to modify values for the Top N filter. Instead of setting a specific value for the filter, you can use a parameter to set the value dynamically by the user. For example, if you want to create a report that shows the top 5 sales, you can use the parameter in place of it. So you can change the report to show the top 10, 15, or 20 sales.
Open the filter dialog box, go to the 'Top' tab. Select the 'By field' radio button. You will have a drop-down for the 'Top' option. You can choose the available parameters from the drop-down, or you can create a parameter right there.
Using parameters in a reference line
You can modify a reference line, band, or box by using parameters for it. So the reference line can be moved according to your preference, instead of fixing it at a location on the axis. Open the 'Add Reference Line, Band, or Box' dialog box. You will get the list of available parameters in the drop-down of the 'Value' field. You can choose one or create a new parameter right there.
Subscribe to our YouTube channel to get new updates..!
Difference between parameters and filters in Tableau
- Both filters and parameters help viewers to view the visualization based on some conditions. Here are the differences between the two.
- Filters are specific to the data source. Parameters are not specific to the data source.
- Filters should be created per worksheet. Parameters are created once, and they can be used across the entire workbook.
- We can select multiple values for filters. But we cannot select multiple values for parameters.
- We can use parameters in calculated fields, and we cannot use filters in calculated fields.
- You can set the data type for the values in parameters. But we cannot do that in filters.
If you want to Explore more about Tableau? then read our updated article - Tableau Tutorial
How to link two parameters in Tableau
Linking two parameters is important in Tableau when you want to make one parameter dependent on other parameter filters. This means that the output of the first parameter will be the input of the second parameter. For instance, consider that you have a map visualization for sales in all the states. You also have a visualization that shows the sales, stock, and demand based on state. Now, if you want to link these two visualizations, i.e., when the viewer selects a state on the map, the next visualization should show the sales, stock, and demand for that state. Here is the process on how to link parameters.
- Firstly, create a parameter that works as a primary filter in Tableau Desktop.
- Create a calculated field to control the list of values that will be displayed that refer to the first parameter.
- Create the second parameter that uses the first calculated field.
- Create a second calculated field that refers to the second parameter as a filter.
Take your career to next level in Tableau with HKR.Join Tableau Web Authoring Training now.
Conclusion
Parameter controls are similar to filter cards that contain the controls to modify the view. The parameter controls are available for both the worksheets and dashboards. They will also be available to the viz that you publish to Tableau Server or Tableau Online. Now that you learned about parameters, you can try using them in your visualizations in Tableau. For more details, refer to our other posts on Tableau on our website.
Related Articles:
About Author
As a senior Technical Content Writer for HKR Trainings, Gayathri has a good comprehension of the present technical innovations, which incorporates perspectives like Business Intelligence and Analytics. She conveys advanced technical ideas precisely and vividly, as conceivable to the target group, guaranteeing that the content is available to clients. She writes qualitative content in the field of Data Warehousing & ETL, Big Data Analytics, and ERP Tools. Connect me on LinkedIn.
Upcoming Tableau Certification Training Online classes
Batch starts on 26th Dec 2024 |
|
||
Batch starts on 30th Dec 2024 |
|
||
Batch starts on 3rd Jan 2025 |
|