Tableau Keep and Exclude filter options

In Tableau, filters play an essential role in restricting the data, and this article explains the most straightforward and potent technique called Keep and Exclude filter options with an example.

To demonstrate the Tableau Keep and Exclude filter options, we used the Sample Superstore Excel sheet. Please visit the Excel Source article to understand the Data Source.

Tableau Keep and Exclude filter options Example

Drag and drop the Sales Measure to the Columns shelf and product Subcategory dimensions to the Rows Shelf. By default, it will create a Horizontal Bar Chart. If not, change the Marks from Automatic type to Bar. Next, add Category to the Color shelf to add colors to the bars and use the T button in the toolbar to add the Data labels. For the remaining charts in Tableau, please click here.

Sales by Subcategory Bar chart

Selecting one or more fields within the report section will open a tooltip window, as shown below. Tableau has information about the selected items, Keep Only, Exclude Filters, Groups, sort, etc. In this example, we will concentrate on the Keep Only option, so please click that option.

Tableau Keep and Exclude Filter Options 2

If you look at the report, it shows the Subcategories that we selected for the Keep Only option. It also automatically added the Inclusions(Category, Sub-Category) on the Filter shelf to avoid the remaining items.

  1. Context Filters
  2. Conditional Filters
  3. Data Source Filters
  4. Extract Filters
  5. Filters on Dimensions
  6. Filters on Measures
  7. Quick Filters
  8. Selection Filter
  9. Slicing Filters
  10. Top and Bottom Filters
  11. Action Filters
  12. Parameters
  13. String Parameters
Tableau Keep and Exclude Filter Options 3

Click the down arrow beside the Inclusions(Category, Sub-Category) and choose the Edit filter option to view the internal things. If you observe the image, by default, it chooses the General Tab with the Select from List option. Next, it checked all the Sub-Categories selected for Keep only and unchecked the remaining ones.

Edit Items

Please undo the above Keep only steps or delete the Inclusions from the Tableau Filters shelf to demonstrate the Exclude option. To do so, select the unwanted product Subcategories and choose the Exclude option.

Tableau Keep and Exclude Filter Options 5

If you see the report, it shows all the Subcategories except the ones that we selected for the Exclude option. It automatically added the Exclusions(Category, Sub-Category) on the Filter shelf.

Tableau Keep and Exclude Filter Options 6

Let me add another, i.e., Segment to the Rows shelf, and the Filter will work intact.

Tableau Keep and Exclude Filter Options 7