Last Modified Date: 18 May 2020
- Tableau Desktop
- Blended data
Option 1Apply a filter across multiple primary data sources by following the instructions in Filter Data Across Multiple Data Sources in Tableau Help.
Option 2Use a parameter with a calculated field to filter the secondary data source at the row level. The attached workbook and the following steps illustrate the process. In this example, Superstore Sales is the primary data source and Coffee Chain is the secondary data source.
Step 1: Create the Parameter
- Right-click in the Data window and then select Create Parameter.
- In the Create Parameter dialog box, name the parameter. In the example workbook, the parameter is named Select a Region.
- Under Data Type, select String.
- Under Allowable values, select List.
- Enter the desired values in the List of values.
- When finished, click OK.
- Right-click the parameter and then select Show Parameter Control.
Step 2: Create the Calculated Field
- To create a new calculated field, from the primary data source (here: Sample Superstore), select Analysis > Create Calculated Field.
- In the Create Calculated Field dialog box, name the field. In this example, the calculated field is named Region Filter.
- In the formula field, enter the following formula:
IF [Select a Region] = [Region] THEN [Region] END, and then click OK.
Step 3: Create the View
- Double-click State to create the map view.
- Drag the Region field to the Color shelf on the Marks card.
- Click the drop-down arrow on the Marks card and select Map.
- In the Data window, click the Coffee Chain data set.
- Drag Number of Records to Label on the Marks card.
- In the Data window, click the Superstore Sales data set.
- Drag the Region Filter calculated field to the Filters shelf.
- In the Filter dialog box, select the check box next to Null and the check box next to Exclude, and then click OK.
To view the Option 2 in action, see the video below.
Note: the video has no sound. To view the video in higher quality, click the YouTube icon below to watch it on YouTube directly.
- It is not possible to filter a secondary database at the row level using the Filters shelf, but it is possible to use a parameter in conjunction with a calculated field to filter the secondary data source at the row level. Whereas a filter simply excludes rows of data, logic can be applied to a calculated field to zero out certain rows if the given condition is met.
- The calculated field must be built in the secondary data source, and must check to see if the current row matches the parameter selection, and return a value if it does, null or zero otherwise.
- Quick filters cannot filter across data sources.
- The parameter should contain all possible filter values.
Discuss this article...
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Training and Tutorials