This example walks you through how to create a context filter. First you’ll filter a view to show the top 10 products by sales. Then you’ll create a context filter on product category so you can see the top 10 furniture products.
Use the Sample - Superstore - English (Extract) data source to create
the initial view shown below. The view shows the sales for all products
sorted with the highest sale at the top.
Now create a Top 10 filter to just show the top selling products.
You can create this filter by dragging the Item field to the Filters shelf. In the Filter dialog box,
switch to the Top tab and define a filter
that is Top 10 by Sum of Sales. See Adding Limits to Filters to learn more about defining a Top N filter.
When you click OK, you’ll see that
the view is filtered to show the top 10 products in terms of sales.
Now, let’s add another filter to only show only furniture
products. Drag the Department field
to the Filters shelf and select Furniture.
When finished, click OK.
The view is filtered but instead of 10 products, it now only
shows 3. The reason is because by default all filters are evaluated
separately and the view shows the intersection of the results. So this
view shows that three of the top 10 overall products are furniture
To find out what the top 10 furniture products are we need
to make the Department filter a context filter. Right-click
the field on the Filters shelf and select Add to Context.
The filter is marked as a context filter and the view updates
to show the top 10 furniture products. Tableau has first evaluated
the data source and identified all of the furniture products. Then
the Top 10 filter is evaluated on the results of that context.