When we learn algebra one of the most fundamental thing we learn is the concept of BIDMAS/BODMAS. To anyone who does not remember it from their maths class, this is essentially the order of operations algebra calculation should be performed. The order is Brackets, Indices, Division, Multiplication, Addition and finally Subtraction; performing an equation in a different order will lead to a wrong solution.
Similarly, Tableau has implemented an equivalent concept. As the software performs multiple operations at the same time, some actions take in effect earlier than others. Thus, when you add a calculation or add the filter, they are always executed in the order established by this order of operations.
Granularity
Before looking at the order of operation, it is essential to understand how granularity works to understand how the calculations are performed and what the order of operations are in Tableau.
As you go down the order of operation the data become more granular and less aggregate.
When you are analyzing a data set, make sure you are aware of the granularity of the data you are working on to ensure you are always doing the correct calculations.
Extract Filter
This is the top level of filter. This can be used to filter out the unnecessary data which can be useful when dealing with a large data base since it can be used to speed the process of creating the extract. If we have a dataset with multiple States and we choose just California, then Tableau produces a .tde file for the state of California and removes all of the other states in the data set.
Data Source Filters
This filter can be applied regardless if the data source is live or an extract. This is a useful filter when using to govern the data as the users are not able to see and modify the data source filters. The difference between the data source filter and extract filter is that the extract from Data source filter will still have data which has been filtered out. So, going back to the example of states, if we use data source filter out ‘California’ state, the tde file will still have the data on other states.
Context filters
It can only be used for dimensions and not measure values. This a is a row level filter which is why it is in a higher level of the order of operations.
When you right click on the filter shelf
LOD filters
FIXED level of detail expressions computes a value using the specified dimensions, without reference to the dimensions in the view. It does not consider what the level of granularity the viz is in, fixed allows calculations at the specified level however, the pathway of the dimensions has to be explicit.
Hence it does not matter if the view is in country, state or city level. Fixed helps us to calculate field from any granularity as long as it is specified
Include/Exclude LODs
Include and Exclude LODs are dependent on what’s in the dimension field, hence it is in the lower order of operations to the dimension filters.
The include LOD allows a user to add dimensions in the calculation, without changing the viz. Essentially, the viz will be at a higher level but calculation can be done at a more granular level.
The exclude LOD allows the user to have a viz which is in a lower level of granularity but have calculation at are more aggregate level