**Order of Operations**

To understand how Tableau works it is useful to know the order in which it manipulates and filters data when producing your view. This process is called the order of operations. It helps to know the order of operations so you can use it to your advantage when using any kind of filter or level of detail calculation, or if you ever find yourself confused as to why Tableau won’t produce the view you want.

Extract/Data Source Filters

Extract and data source filters are first in the Tableau order of operations. They can be applied in the data source page and essentially filter your data before it enters into Tableau. This can be useful if you have fields in your data that you know you will not need or consider. In the example below France is missing from the map but there are no filters applied on the filters pane. This is because a data source filter was applied before creating the view.

Context Filters

Context filters are the same as dimension filters but have been applied to context by right clicking the filter and choosing “Apply to context.” This means that they can only filter discrete/categorical fields for example category or country. The purpose of context filters is to allow dimensions to be filtered earlier in the order of operations. A context filter will show as grey in the filters pane as opposed to the usual blue.

Sets, Conditional and Top N Filters, Fixed Level of Detail Calculations

Next in the order of operations is sets, conditional and top n filters and fixed LOD calculations. This means that they will all be calculated before dimension filters. This means level of detail calculations can be used to show whole values that would normally be filtered out by dimension filters which can be useful for comparisons of filtered vs unfiltered and many other things. If you need to use a fixed LOD calculation but want it to be filtered by a dimension then you can add the dimension filter to context.

In the example below the fixed sales on the left show full sales value for all sub-categories whereas the sales show the sales value for all sub-categories but only for the consumer segment (other segments are filtered out). On the right both the sales and fixed sales show the value for the consumer segment for each sub-category as the segment filter has been added to context.

Conditional and top n filters are optional filter types found within the dimension filter options but they come before regular dimension filters in the order of operations. This can also influence your view in ways you would otherwise not expect. For example in the example below on the left the top 3 sub categories are displayed by sales and the region has been filtered to Central only. The right shows the same set up but with the region filter added to context. This causes bookcases to be swapped out of the top 3 for storage, and it does have a higher sales value.

Dimension Filters

As stated above dimension filters are the regular filters which reduce discrete/categorical variables down. You can select fields to include or exclude and this will affect the view in different ways depending on what has come before it in the order of operations.

Data Blending

Data blending comes after dimension filters, therefore only fields which have not been filtered out will be blended across data sets.

Include and Exclude Level of Detail Calculations

Include and exclude level of detail calculations are similar to fixed LOD’s from earlier in the order of operations in that they influence the level of detail being considered in a view. Include LOD calculations tell the calculation which fields to include in the level of detail whereas exclude do the opposite. This does not result in same views as fixed LOD calculations however as they occur later on in the order of operations.

Using the same example as earlier but replacing the fixed calculation with an include sub-category level of detail calculation results in the sales value being the same as the sales variable. This is because unlike the fixed calculation the include sub-category logic occurs after certain sub-categories have been filtered out by the dimension filter. Therefore a context filter is not required to affect include and exclude LOD calculations.

Measure Filters

Measure filters are the filters that influence continuous/numeric fields by setting a minimum or maximum value for example. These occur after all level of detail calculations and are the final filter to influence the view.

Totals, Forecasts and Table Calculations, Trend Lines and Reference Lines

Totals are next in the order of operations and they are calculated within the view. Next are table calculations and forecasts with are also calculated in the view. Finally trend lines and reference lines are calculated and they also are calculated within the view.