Tableau
Parameters
Learn how to create and use parameters to give your Tableau dashboards dynamic interactivity: controlling calculations, filters, and visual behavior on the fly.
What Is a Parameter?
A parameter in Tableau is a workbook variable that holds a single value: a number, a string, a date, or a boolean. Unlike fields that come from your data source, a parameter is a value that you define and that users can change at runtime.
Why Parameters Matter
Anatomy of a Parameter
The Core Rule of Parameters
The parameter is the input. It must flow through a calculated field, a filter, or a reference line before the visualization changes.
Parameter Data Types
| Data Type | Example Value | Common Use Case |
|---|---|---|
| Integer | 5000 | Top N, thresholds |
| Float | 0.15 | Profit margin, rates |
| String | "Sales" | Measure swapping |
| Date | 2024-01-01 | Date range control |
| Boolean | TRUE | Toggle features on/off |
Parameters vs Filters
| Feature | Parameter | Filter |
|---|---|---|
| Source of values | You define them | Data source |
| Number of values | Exactly one | One or many |
| Cross-sheet? | Yes, by default | Only if applied globally |
| Affects query? | Only via calculated field | Directly |
| Auto-updates? | Not automatically | Yes |
How to Create a Parameter
Example 1: Top N Filter
Goal: Let the user choose how many products to show in a bar chart. We create a parameter called Top N of type Integer with a range of 1 to 20.
Example 2: Measure Swapper
Goal: Let users toggle a line chart between Sales, Profit, and Quantity using a single parameter.
// Allowable values: "Sales", "Profit", "Quantity"
// Calculated Field: "Dynamic Metric"
CASE [Select Metric]
WHEN "Sales" THEN [Sales]
WHEN "Profit" THEN [Profit]
WHEN "Quantity" THEN [Quantity]
END
Example 3: Dynamic Reference Line
Goal: Add a reference line to a scatter plot whose position the user controls. Create a Float parameter called "Goal Line" with a range of 0 to 100,000.
Allowable Values: All, List, Range
Parameters in Calculated Fields
Parameters appear in the calculation editor under their own section. Reference them by wrapping the name in square brackets:
\( \text{IF } [\text{Sales}] \ge [\text{Sales Threshold}] \)
THEN "Above Target"
ELSE "Below Target"
END
\( [\text{Order Date}] \ge [\text{Start Date}] \)
AND
\( [\text{Order Date}] \le [\text{End Date}] \)
Parameter Actions
Since Tableau 2019.2, Parameter Actions let you update a parameter's value by clicking a mark in a visualization, not just using a control widget.
Common Mistakes
Summary Cheat Sheet
| Pattern | Parameter Type | Key Calculated Field |
|---|---|---|
| Top N | Integer, Range | \( \text{INDEX}() \le [\text{Top N}] \) |
| Measure Swap | String, List | \( \text{CASE } [\text{Param}] \) |
| Reference Line | Float, Range | No calc needed |
| Date Window | Date, All | \( [\text{Date}] \ge [\text{Start}] \) |
| What-If Analysis | Float, Range | \( [\text{Sales}] \times [\text{Growth Rate}] \) |
Question 1 of 5
What must happen before a parameter can change the appearance of a visualization in Tableau?
Question 2 of 5
You want users to toggle between "Sales", "Profit", and "Quantity". Which parameter configuration is best?
Question 3 of 5
How many values can a Tableau parameter hold at one time?
Question 4 of 5
A student creates an Integer parameter with a Range of 1 to 10 and drags it onto the Columns shelf. What happens?
Question 5 of 5
Which Tableau feature (introduced in 2019.2) allows a parameter's value to change when a user clicks a mark in a viz?