Mastering Tableau Order of Operations: Workout Wednesday 2022 Week Insights

Filter Challenge: How well do you know Tableau Order of Operation

Suparna Chowdhury
5 min readSep 26, 2024

In Tableau, filters are processed in a specific sequence called the Order of Operations. This order is important to understand because it determines how different filters interact and affect the results in your visualizations. Different filters such as Extract Filters, Data Source Filters, Context Filters, and Dimension Filters — each applied in a defined order.

Tableau Order of Operation:

Tableau Order of Operation (Source: Tableau Website)

This Workout Wednesday challenge focuses on the Order of Operations in Tableau, giving us the chance to enhance our skills by exploring how filters interact. It’s a fantastic opportunity for us to dive into some complex filtering scenarios and deepen our understanding.

To create this dashboard, we require to know context filter and dimension filter.

Context filter

  • Context filter is an independent filter that sets a context for other filters.
  • Context filters are only for dimensions.
  • Once a context filter is applied, other filters like dimension filter, measure filters are evaluated against the data that remains after the context filter has been applied.
  • Context filters can enhance performance, especially in large datasets, since it reduces the data before it is brought into Tableau.
  • We can set a filter as a context filter by right-clicking on the filter in the Filters shelf and selecting “Add to Context.” The context filter will be highlighted in gray.
  • Common scenarios include filtering data by a specific dimension before applying additional filters like Numerical or Top N filters.

Dimension filter:

A dimension filter in Tableau allows us to restrict the data displayed in your visualizations based on specific dimensions.

Building the dashboard:

Sheet 1: Legend

  1. Add Region to the Columns shelf and change the Marks type from Automatic to Square. Next, drag Region to the Label and Color marks cards.
  2. To create an inline field, double-click in the Columns shelf (next to Region) and type two single quotes (‘’).
  3. Click the Size marks card and adjust the size as needed.
  4. Finally, hide the headers by right-clicking on both fields in the Columns shelf and unchecking Show Header.

Sheet 2: State Map

  1. Double-click State to load a map, then drag the Country/Region field to the Detail marks card. Change the mark type to a Map, add Region to Color, and adjust the color as desired.
  2. Next, remove all map layers by right-clicking on the worksheet and selecting Background Layers. In the new window, drag the Washout slider to 100%. Change the border on the Color shelf to white.
  3. Drag a new instance of State onto the sheet to create a second marks layer on the left. Change the mark type to Circle, set the circle color to black, and add Sales to the Size marks.
  4. Finally, remove row and column dividers and format the tooltip as needed.

Sheet 3: Top 10 SubCats

  1. Add Sub-Category to the Rows shelf and Sum(Sales) to the Columns shelf.
  2. Then, add Sub-Category to the Filters shelf and set it to a Top 10 filter by Sales.
  3. Finally, format the tooltip and gridlines as needed.

Sheet 4: Top 10 Customers

We need some calculated fields:

  1. Max Order Date:

{MAX([Order Date])}

2. Latest Order Date:

{FIXED [Customer Name] : MAX([Order Date])}

3. Latest Sales Amount:

IF [Order Date] = [Latest order date]
THEN [Sales]
END

4. Days Since Latest Purchase:

MAX(DATEDIFF(‘day’,[Latest Order Date],[Max Order Date]))

On a new sheet, add Customer Name to Rows and Sales to Text. Order by Sales Desc. Format Sales to £ with 0dp. Double-click on Latest Sales Amount and Days Since Latest Purchase to include them into the table.

Drag Customer Name to Filter shelf and and set to filter by the Top 10 based on Sales.

The Worksheet looks like:

Applying filter Action and Context filter:

Add all the sheets to the dashboard. Item Hierarchy:

Create a dashboard filter action for Legend sheet:

Then, add another filter action for State Map Sheet:

To verify the visualization, set the Region to West by clicking on West in the Legend sheet on the dashboard. This will display only 8 customers in Top 10 Customers sheet. This occurs because Tableau is looking at the Top 10 filters and Region Filters together. In this case, the data is first filtered to show the top 10 customers based on sales, and then the Region filter limited the results to those with sales in the West. As a result, only 8 of the top 10 customers had sales in that region, leading to 8 rows in the sheet.

Now, select any state, such as Montana from the Map. We will find that there are no customers in the Top 10 and only 5 categories.

To fix this, go to Top 10 SubCats and Top 10 Customers worksheet, set the Region Actions as a context filter by right-clicking on Region in the Filters shelf and selecting “Add to Context.” This ensures that all customers from the West are included first, and then the Top 10 customers by Sales will be applied to display the top 10 customers specifically from that region.

We also need to set the other action filter as a context filter to ensure it properly narrows down the data based on the selected state.

After adding to context, the Top 10 SubCats and Top 10 Customers sheets will display only the relevant data for the selected context, showing the top customers and sub-categories specific to the filtered region or criteria.

Tableau Public Dashboard:

https://public.tableau.com/app/profile/suparna.chowdhury/viz/WOW2022Week15FilterChallenge_17162417026110/FilterChallenge

--

--

Suparna Chowdhury
Suparna Chowdhury

Written by Suparna Chowdhury

Hey! I'm into all things data—data science, machine learning, SQL, and Tableau. Join me as I simplify complex ideas and explore the power of data!

No responses yet