Order of Operations and its importance

by Débora Contente

Before joining the data school, I remember spotting a few posts on the Order of Operations in Tableau and thinking “Why do they bother to know this? Will it make any difference in the end?” Contrarily to what I thought, the answer is yes – it will actually make a difference and it is actually relevant when building your dashboards. Creating dashboards without knowing Tableau’s order or operations is like doing maths without knowing that you first do the multiplications and then do the sums (I’ve stolen this metaphor from Aj Basne who wrote a really good post on Order of Operations too!).

So here I am, trying to get this in my head and sharing it with you! Let’s start with my piece of art – a list of Tableau’s operations sorted by when each takes place from first (at the top) to last (at the bottom).

Fig.1 – Tableau’s Order of Operations

I have included the Fixed, Include and Exclude – which are known as LODs (Level of Detail) calculations – in the image but in this blog post (I refuse to use the word blog as for me a blog is the whole thing, not a singular post, I’m sorry…) I will only be exploring the filters represented inside the rectangles (Extract, Data Source, Context, Set, Dimension, Measure and Table Calculations).

What happens first – Extract and Datasource Filters

These filters will affect the data that will enter into Tableau, therefore it makes sense they come first.
Extract Data (figure 2 below) is a useful function that allows you to filter your database in a way that Tableau will only load the data you need. A snapshot of it will be saved in Tableau’s cache and you will be connected to it instead of directly to the database.
Datasource filters (figures 3 and 4 below) are pretty self-explanatory: if you have some fields in your data that you know you won’t be using, you can filter them. This will stop Tableau from wasting space with unnecessary data.

These filters will affect the data that will enter into Tableau, therefore it makes sense they come first.
Extract Data (figure 2 below) is a useful function that allows you to filter your database in a way that Tableau will only load the data you need. A snapshot of it will be saved in Tableau’s cache and you will be connected to it instead of directly to the database.
Datasource filters (figures 3 and 4 below) are pretty self-explanatory: if you have some fields in your data that you know you won’t be using, you can filter them. This will stop Tableau from wasting space with unnecessary data.

Figure 2 – Extract Filter

Context Filters

These are the ones I had never heard of before the Data School. I like to think of them as essentially Dimension filters that have been added to context so that they are applied before set filters. To do it you just right click on your dimension filter and select Add to Context. This little trick is truly useful, and without knowing the order of operations of Tableau, you would not have a clue on why it works! One way of differentiating it from other filters is its colour – context filters become grey.

GIF 1 – Context Filters

Set Filters

Set filters are next on the list. They can be added in (at least) two different ways – by creating a Set or by using a sheet as a filter (something you usually do in a dashboard). You can tell if a filter is a set filter quite easily as it will have its own symbol – the one that is circled in red in figure 5.

Figure 5 – Sets and its symbol

Dimension and Measure Filters

I will not get into detail on the differences between measures and dimensions in this blog post so let’s just say that both can be added as filters by dragging them into the Filters shelf, and that these come second last in Tableau’s order of operations.

Table Calculation Filters

Creating Table Calculations would not fit in this post. So once again let’s just focus on the most important facts – they are calculated in the view so it makes sense they belong lastly in this order.

I hope this long blog post has been helpful for you. It has certainly been for me as it made me go through every detail and actually understand it. Please let me know if you have any questions or suggestions for improvement!

You can read more on Order of Operations here:
/harry-cooney/tableaus-order-of-operations/
/ellie-mason/order-of-operations-sorting-within-a-filter/
/joe-macari/talk-tablish-lesson-3/