Filter order of operations for Tableau.

by Brandon Fitz-Gerald

During the DS20s first ‘Tableau Fundamentals’ lesson today, we were introduced to the idea of having multiple filters in one sheet. The questions on everyone’s mind: “What order will the filters happen in?” and “Can we change which order the filters happen in?”. The answer to these questions lies in the Order of Operations.

Figure 1:Tableau’s Order of Operations for Functions. Top to Bottom.

Think of this order of operations similar to BIDMAS! One part of the sequence has to happen before the next one can begin. Context Filters have to happen before Set Filters. Set Filters have to happen before Dimension Filters. You get the idea.

The situation we were given included using filters to find which two US states in a given region had the highest profit. We wrote the two filters below to choose a) the region, and b) the top two states! These are both dimensions (Important to remember when we look back at our order of operations.

I thought (before learning about the order of operations) that having these run at the same time would bring back the two states with the highest profit in the region with the highest sales….. I wasn’t quite right.

Figure 3: First attempt: Only one state was highlighted?!?

Only one state had been highlighted. When I went back to check this was the state with the highest overall Sales. Looking back at our order of operations, we would need our region filter to run before our state filter to get the desired result. Only set filters and context filters come before dimension filters in our order of operations. But which one should we use?

Here’s a hint: A later blog by another DS20 cohort member, Blair, will look at how we can use context filters.

Figure 4: The result! Both Washington and California are highlighted. The two states with the highest profit in the East region! Hurray!