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.
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.
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.
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.
- Context Filters
- Conditional Filters
- Data Source Filters
- Extract Filters
- Filters on Dimensions
- Filters on Measures
- Quick Filters
- Selection Filter
- Slicing Filters
- Top and Bottom Filters
- Action Filters
- String Parameters
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.
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.
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.
Let me add another, i.e., Segment to the Rows shelf, and the Filter will work intact.