#### So Just how does the Order of Operations affect your calculations?

#### Tableau, like most systems, has an order or sequence in which filters are applied and calculations are executed. The process starts at the top and proceeds to the bottom in a single pass. Calculations executed lower in the order depend on all the steps that precede them.

**Steps 1 and 2 – Extract and Data Source Filters**

First just a quick work on the first 2 filters – Extract and Data Source work as data is loaded from the source and limit the amount of data available workbook.

The remaining filters are executed in the context of a worksheet and limit the data that is included in the table that underlays that sheet – filters on a worksheet can be applied to other sheets to limit the underlying table on those sheets also.

**Step 3 – Context Filters:**

Placing a dimension "In Context" will apply the filter before any calculations are executed, the Top N is determined or Sets are formed. – The data associated with the filter is not on the worksheet's underlying table and is therefore not available to the remainder of the order of operation.

Just open the drop-down and select Add to Context

** **

**Step 4 Sets, Fixed LOD and Top N**

I'm going to use this simple table in the next few examples to show the effect of context filters

**Step 5 – Dimension Filters**

**Step 6 – Data Blending**

**Step 7 – Include and Exclude LOD's**

**Step 8 – Measure Filters**

Now, look at how the Row Level Measure filter produces a different result

The filter is NOT an aggregate (no SUM() around the measure)

But for this view, the result is the same as the aggregate example

Collapse the hierarchy as before the results are different – and 2 totals 37 and 55 are not filtered out – Why? –

The filter is applied at the row level in the data table and all the values between 10 – 35 are included – Then when the measure is brought to the viz they are summed –

** **

**Step 9 – Grand Totals **

Much like Blending Data – Grand totals are a large topic and will be addressed in later posts – But note that Grand Totals are before Table Calculations –

**Step 10 – Table Calculations**

As the name implies, Table Calculations are applied to the underlying table for the individual worksheet. At the bottom of the order of operations, they work with the fully filtered data and are always aggregates. They also can't be used in calculations that precede them in the order of operation – e.g. Table Calculations, Sets, or Top N –

They are extremely powerful tools used to compare data, total, look up or provide running sums across or within the data table -understand their position in the order of operation is at the bottom and the data table has been set. Using Table Calculations will be the subject on another FAQ so come back.

Hope this helps provide a better sense of what the order of operation is and how it is important when creating your viz

A workbook containing the examples used here can be found and downloaded from

Link to workbook

Presented at Pittsburgh TUG 12/17/20 see Video link at the 45-minute mark

Enjoy and let me know if you have questions

Jim