Graphic Source: Tableau’s Order of Operations
What is the Order of Operations?
Depending on where you are in your Tableau journey, you may or may not have come across Tableau’s Order of Operations. This hierarchy shows the order in which the operations or actions in a visualisation are carried out. As a beginner, you learn about filters and simple table calculations and you’re most likely not tuned into what’s happening in the background as you try to master each new piece of functionality. In the first instance, I’m normally so focused on my analysis and what flexibility I want to allow, that I’m not consciously thinking about what’s going on behind the scenes. As I test a dashboard by interacting with it in different ways, I might notice that views are not showing me what I expected to see. If you want to achieve a specific result, it is critical to understand which operations are prioritised ahead of others. I would recommend reading through the information contained in the link above if you want more detail.
Why is it important?
It’s very easy to drag and drop dimensions and measures around your view in Tableau and add in flexibility, giving the users choice. However, if you don’t make deliberate choices in terms of how you allow them to slice the data and what types of calculations you select, taking the order of operations into consideration, you may well be disappointed with the result.
Consider this example. You want a dashboard analysing European sales across every country and a bar chart with your top 10 customers shown, indicating their percentage of the overall total (see below). You want to allow the user to click on a country and show the top 10 customers for that country. This may seem straightforward and intuitive to you, but the defaults will present you with something else. Please refer to dashboard A) in my workbook on Tableau Public here. Firstly, the percentages add up to 100%, so what you’re seeing is the portion they contribute to the top ten, not the overall total. This is because Top N filters are applied before table calculations are carried out. To achieve what you want, you can use a fixed level of detail (LOD) calculation instead. Secondly, if you filter on a country e.g. Ireland, the view with the top 10 disappears, as none of the customers in Ireland are in the top 10 overall. This happens because the Top N filter is applied before your dimension (country) filter. If you select ‘Apply to Context’ in the drop-down menu of the country action filter (in the filter shelf), this will ensure your country is selected first and then your top 10 within that country will be shown. Dashboard B) here shows the updated version.
I’m sure there is logic behind Tableau’s order of operations but currently for me, it’s something arbitrary, so I need to learn it. I remember the first three and then it gets fuzzy and I often need to consult the website. So I have made a concerted effort to commit it to memory. I’ve used mnemonics a lot throughout my life. I encountered my first mnemonic when I was five and started learning the piano. In order to learn that the notes on the line on the Treble Clef from bottom up were E G B D F, I learned that “Every good boy deserves fun” and it’s been burned into my brain ever since (I didn’t think to ask at the time if good girls deserved fun too, but that’s beside the point). One might have thought that at this stage in my life I’d have progressed beyond this tool but I find it still helps me learn in certain cases and here we have one such case. This is what I have come up with and I thought I’d share in case anyone else finds it useful.
“Every Diligent Consultant Seeks Data In Multiple Fresh Trusted Tables.”
Please refer to the graphic at the top to see the words beside each element.
That’s my twopence worth this Tuesday! Thanks for reading and feel free to leave a comment.