Filtering the Secondary Data Source Independently of the Primary

Published: 26 Feb 2013
Last Modified Date: 18 May 2020


How to filter the secondary data source, at the row level, without filtering the primary data source.


  • Tableau Desktop
  • Blended data


Option 1 

Apply a filter across multiple primary data sources by following the instructions in Filter Data Across Multiple Data Sources in Tableau Help. 

Option 2

Use 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
  1. Right-click in the Data window and then select Create Parameter.
  2. In the Create Parameter dialog box, name the parameter. In the example workbook, the parameter is named Select a Region.
  3. Under Data Type, select String.
  4. Under Allowable values, select List.
  5. Enter the desired values in the List of values
  6. When finished, click OK.
  7. Right-click the parameter and then select Show Parameter Control.
Note: the parameter belongs to the workbook and can be created from any data source (primary or secondary).
Step 2: Create the Calculated Field
  1. To create a new calculated field, from the primary data source (here: Sample Superstore), select Analysis > Create Calculated Field.
  2. In the Create Calculated Field dialog box, name the field. In this example, the calculated field is named Region Filter.
  3. In the formula field, enter the following formula: IF [Select a Region] = [Region] THEN [Region] ENDand then click OK.
Step 3: Create the View
  1. Double-click State to create the map view.
  2. Drag the Region field to the Color shelf on the Marks card.
  3. Click the drop-down arrow on the Marks card and select Map.
  4. In the Data window, click the Coffee Chain data set.
  5. Drag Number of Records to Label on the Marks card.
  6. In the Data window, click the Superstore Sales data set.
  7. Drag the Region Filter calculated field to the Filters shelf.
  8. In the Filter dialog box, select the check box next to Null and the check box next to Exclude, and then click OK.
Even though the view and filters are built via the primary data source, the view is controlled by the parameter which filters the secondary data source at the row level.

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.

Additional Information

  • 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... Feedback Forum
Did this article resolve the issue?