1. Overview
In Tableau filter using parameters enables users to adjust the data shown in visualizations according to their selections. Here’s a step-by-step guide to setting up filters with parameters:
2. Tableau filter using parameters
Create a Parameter:
- Open your Tableau workbook and navigate to the worksheet where you want to apply the filter.
- In the Data pane, right-click on Parameters and select Create Parameter.
- In the Create Parameter dialog:
- Name: Enter a descriptive name (e.g., “Select Region”).
- Data Type: Choose the appropriate type (e.g., String, Integer, Date).
- Current Value: Set a default value.
- Allowable Values:
- All: Users can enter any value.
- List: Provide a specific list of values for users to select from.
- Range: Define a range of values if applicable.
Show Parameter Control: Right-click on the newly created parameter in the Data pane and select Show Parameter Control. This will add the parameter control to your worksheet, allowing users to select values.
Create a Calculated Field for Filtering:
- Right-click on your dataset in the Data pane and choose Create Calculated Field.
- Name the calculated field (e.g., “Region Filter”) and enter a formula that uses the parameter.
- This calculated field will return true for rows that match the selected region from the parameter.
Use the Calculated Field as a Filter:
- Drag the calculated field (e.g., “Region Filter”) to the Filters shelf.
- In the Filter dialog, select True to filter the data based on the parameter’s value.
Integrate into Visualizations: Create visualizations with the parameter filter. As users change the parameter value, the visualizations will automatically update to reflect the selected data.
Example Use Case
Suppose you have a sales dashboard and you want users to filter the data by different regions:
- Create a Parameter: “Select Region” with a list of regions (e.g., North, South, East, West).
- Create a Calculated Field: Use the parameter to filter data:
[Region] = [Parameter Region]
- Apply the Filter: Drag this calculated field to the Filters shelf to only display data for the selected region.
3. Summary
Filtering data using parameters in Tableau provides users with the ability to control the content displayed in visualizations, tailoring the analysis to their specific needs and preferences. This feature enhances the user experience by allowing them to specify criteria for data selection dynamically, with no need to create multiple static views.
You can find our code samples in our GitHub repository. To learn more about Tableau, refer to these articles.