1. Overview
You can create a parameter in Tableau to customize calculations, filters, reference lines, and more. Parameters allow users to interact with the dashboard, providing a way to customize the view based on their inputs.
2. What is a Parameter?
- A parameter is a single, dynamic value to use across the entire workbook.
- Parameters can be numbers, dates, strings, or boolean, depending on how you want them to interact with your data.
- Unlike filters, which directly change the data shown in a view, parameters need to be integrated into calculations or filters to affect the visualization.
3. Create a Parameter in Tableau
Here’s an overview of creating and using parameters in Tableau:
Open Tableau: Start by opening your Tableau workbook where you want to create the parameter.
Go to the Data Pane: In the Data pane on the left side, locate the section called “Parameters” (if it’s not visible, you can create a new parameter from the menu).
Create a New Parameter: Right-click on the “Parameters” section and select “Create Parameter…”.
Define the Parameter: In the “Create Parameter” dialog box, you will need to define as:
- Name: Give your parameter a descriptive name.
- Data Type: Choose the proper data type (Float, Integer, String, Date, etc.) depending on what you need.
- Current Value: Set an initial value for the parameter.
- Allowable Values:
- All: Allows any value.
- List: You can specify a list of allowable values.
- Range: Allows you to specify a range of values.
Set Display Format (Optional):
- You can also set the display format of the parameter value. (e.g., Number, Currency, Percentage).
Click OK:
- After defining your parameter, click “OK” to create it. It will now appear under the “Parameters” section in the Data pane.
3.1. Using the Parameter
Show Parameter Control:
- Right-click on the parameter and select “Show Parameter Control” to display the parameter control on the dashboard.
Use the Parameter in Calculations:
You can now use the parameter in calculated fields, filters, or reference lines.
- Example: Create a calculated field that uses the parameter value:
IF [Order Date] = [FROM_DATE] THEN [Order ID] ELSE NULL END
Integrate with Filters:
- You can link the parameter to a filter by creating a calculated field or directly using it in a filter expression.
Update Visualizations:
- When you adjust the parameter control, the visualizations that use it will automatically update.
4. Why use Parameter
- Interactivity: Parameters allow users to change values on the fly, enabling them to explore different scenarios or adjust the displayed data.
- Flexibility: You can use a parameter in your calculations, to switch between different measures, adjust thresholds, change date ranges, or change other aspects of the visualization.
- Customization: Parameters provide a way to tailor dashboards to the needs of the end-user, making them more useful and insightful.
5. Summary
In conclusion, if you create a parameter in Tableau, it allows you to add interactivity to your dashboards by enabling dynamic inputs for calculations, filters, and visualizations. By defining the parameter, setting its allowable values, and incorporating it into your workbook, you can offer users a more customizable and engaging experience.
Our code samples are in this GitHub repository. For more Tableau tutorials, refer to these articles.