0
0
Tableaubi_tool~5 mins

Parameter in calculated fields in Tableau - Step-by-Step Guide

Choose your learning style9 modes available
Introduction
Parameters let you create a single value input that users can change to control calculations. Using parameters in calculated fields helps you make your Tableau dashboards interactive and flexible without changing the data source.
When you want users to select a threshold value to filter data dynamically.
When you want to switch between different measures or dimensions in a chart.
When you want to let users choose a date or number to adjust calculations.
When you want to create a what-if analysis by changing input values.
When you want to control the calculation logic without editing the workbook.
Steps
Step 1: Create a new parameter
- Data pane, right-click and select 'Create Parameter...'
A dialog opens to define the parameter's name, data type, and allowable values
💡 Name the parameter clearly to reflect its purpose, like 'Sales Threshold'
Step 2: Set parameter properties
- Create Parameter dialog
Parameter is configured with data type (e.g., integer), current value, and range or list of values
💡 Choose a data type that matches the field you will use in the calculation
Step 3: Click 'OK' to create the parameter
- Create Parameter dialog
Parameter appears in the Data pane under Parameters
💡 Right-click the parameter and select 'Show Parameter Control' to display it on the worksheet
Step 4: Create a calculated field using the parameter
- Data pane, right-click and select 'Create Calculated Field...'
Calculation editor opens where you can write a formula using the parameter
💡 Use the parameter name exactly as it appears, for example: [Sales] > [Sales Threshold]
Step 5: Click 'OK' to save the calculated field
- Calculation editor
Calculated field appears in the Data pane and can be used in views
💡 Drag the calculated field to Filters or Color to see the effect of the parameter
Step 6: Adjust the parameter control on the worksheet
- Parameter control on the worksheet
The visualization updates dynamically based on the parameter value
💡 Try different values to see how the calculation changes the view
Before vs After
Before
Dashboard shows sales data for all products without any user input control
After
Dashboard includes a parameter control named 'Sales Threshold' that filters products with sales above the selected value dynamically
Settings Reference
Data type
📍 Create Parameter dialog
Defines the type of value the parameter will accept
Default: Integer
Current value
📍 Create Parameter dialog
Sets the initial value of the parameter when the workbook opens
Default: User defined
Allowable values
📍 Create Parameter dialog
Controls what values users can select or enter for the parameter
Default: All
Show Parameter Control
📍 Parameter in Data pane, right-click menu
Displays the parameter control on the worksheet for user interaction
Default: Hide
Common Mistakes
Using a parameter with a data type that does not match the field in the calculation
The calculation will return errors or unexpected results because the types are incompatible
Ensure the parameter data type matches the field type used in the calculated field
Not showing the parameter control on the worksheet
Users cannot change the parameter value, so the calculation remains static
Right-click the parameter and select 'Show Parameter Control' to allow user input
Using the parameter name incorrectly in the calculation (e.g., missing brackets)
Tableau will not recognize the parameter and show an error
Always use square brackets around the parameter name in calculated fields, like [Parameter Name]
Summary
Parameters let users input values that control calculations dynamically.
Use parameters in calculated fields to make dashboards interactive without changing data.
Remember to match parameter data types and show the parameter control for user input.