Overview
This lecture covers Tableau parameters, their definition, creation, and usage, with multiple practical examples, comparisons to filters, and an introduction to parameter actions.
What Are Parameters?
- A parameter in Tableau is a workbook-level variable (number, date, or string) that can replace a constant value in calculations, filters, or reference lines.
- Parameters are global and can be used across all worksheets in a workbook.
- They can take user input and dynamically change how charts or dashboards behave.
Steps to Use Parameters
- Create the parameter.
- (Optional) Show the parameter control for user input.
- (Optional) Create a calculated field to use the parameter.
- Use (wire) the parameter in calculations, filters, reference lines, or visual controls.
Common Use Cases
- Top N Filtering: User selects how many top records to display using a parameter wired to a filter or calculated field.
- Moving Average: Parameter controls the window size in moving average calculations for smoothing data.
- Date Reference Bands: Two date parameters define a reference band on charts.
- Stacked Bar Sorting: Parameter selects a segment to sort and highlight in stacked bar charts.
- Filtering Unrelated Data: Shared parameters allow filtering across different data sources using calculated fields.
- Dynamic Dimensions/Measures: Parameters let users choose which dimension or measure is shown using a case or if-else statement in a calculated field.
- Dynamic Chart Swapping: Parameters control which sheet (bar, line, or map) is displayed in a dashboard container.
Tips, Tricks, & Constructs
- Case and if-else statements are commonly used to use parameters in calculated fields for logic based on user selection.
- Case statements require exact text matches; be mindful of case and spacing.
- Parameters can be used to simulate axes or dynamically label titles and axes.
Parameters vs Filters
- Parameters are data source-independent; filters are data-dependent.
- Parameters are single-select and global; filters can be multi-select and local.
- Parameters can be used in calculated fields; filters cannot.
- Actions (like parameter actions) are available only for parameters.
Parameter Actions
- Parameter actions let users update parameter values by interacting with the visualization (e.g., hovering or selecting a mark).
- Can be used for features like dynamic reference lines that update on interaction.
Key Terms & Definitions
- Parameter โ A user-defined variable in Tableau used for dynamic interactions and replacing constants.
- Filter โ Restricts data shown in a worksheet, based on data source fields.
- Parameter Action โ Tableau feature allowing parameters to be updated from user interactions.
- Case Statement โ Logical construct to perform actions based on parameterโs value.
- Calculated Field โ A user-defined field using a formula, often incorporating parameters.
- Reference Line/Band โ Visual marker in a chart, which can be set by parameter values.
Action Items / Next Steps
- Practice creating and wiring parameters in Tableau through the demonstrated use cases.
- Experiment with case and if-else statements in calculated fields.
- Explore parameter actions to add interactivity.
- Review differences between parameters and filters as needed.