Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Tableau context filter


May 26, 2021 Tableau


Table of contents


Normal filters in Tableau are independent of each other. T his means that each filter reads all rows from the source data and creates its own results. /b10> However, in some cases, we want the second filter to process only the records returned by the first filter. /b11> Therefore, in this case, the second filter is called a dependent filter because they only process data that passes through the context filter. /b12> Context filters have two main purposes.

  • Improved performance - If you set up a large number of filters or have a large data source, queries can be slow. You can set one or more context filters to improve performance.
  • Create dependent numbers or top N filters - You can set context filters to include only the data of interest, and then set numbers or top N filters.

Create a context filter

Using Thesample-superstore, let's find the top 10 subcategories for a product in a category called furniture. To achieve this, we follow these steps.

Step 1

Drag the dimension category to the row shelf and the measure sales to the column shelf. /b10> Select the horizontal bar chart as the chart type. /b11> Drag the Wiig element category again to the filter holder. /b12> We get the chart below.

Tableau context filter

Step 2

Right-click the field subcategory in the filter shelf, and then go to the fourth tab named Top. /b10> Select options based on the field. /b11> Select the top 10 options by sales from the next drop-down menu, as shown below.

Tableau context filter

Step 3

Drag the dimension category to the filter holder. /b10> Right-click it to edit and select the furniture from the list under the General tab. /b11> As you can see the results show three sub-classes of products.

Tableau context filter

Step 4

Right-click category - furniture filter and select options to add to context. /b10> This results in a final result that shows the product subcategories of the furniture category in the top 10 subcategories of all products.

Tableau context filter