Tableau Order of Operations

What is Tableau Order of Operations?

Tableau order of operations, also known as query pipeline, refers to the order in which different actions or operations are performed. When you create a view and apply filters in Tableau order of operations, many of the operations with filters are executed in a defined order. Hence, the Tableau order of operations dictates the direction in which Tableau executes the filters in a particular order; hence, at times, you may observe the filters may not result in the expected output. 

The order of operations works in the following sequence, as shown below. As observed, Tableau executes the filter order starting with Extract Filter and then moves to the bottom with Table Calc Filters applied to the end.

Tableau Order of Operations - Intro
Key Takeaways
  • Tableau order of operations, also known as query pipeline is the order in which different actions or operations are performed in Tableau.
  • The order of operations dictates the direction in which Tableau executes the filters in a certain order. At times, you may observe the filters may not result in the expected output as a result of this order of execution.
  • Tableau executes the filter order starting with Extract Filter and then moves to the bottom with Table Calc Filters applied to the order end.
  • At times you may experience unexpected output in your Tableau view when you apply filters because of the order in which Tableau executes or applies filters to your dataset.

How to do an Order of Operation in Tableau?

As mentioned in the introduction, Tableau follows a particular order of operation for filter activities. This means that if you don’t apply filters to the Tableau order of operations, you will likely see unexpected results. To do an order of operation in Tableau, you may follow the below steps.

Step 1: Connect to your dataset from the Tableau interface.

Step 2: Apply extract filters to your dataset if you are importing a data extract into Tableau. You can apply the extract filter by clicking on the Edit link in the Data Source tab of the Tableau

Tableau Order of Operations - Step 2

Apply Data Source Filters if you are using a live connection to connect with your dataset.

Step 3: In the Tableau view, you can apply Context filters in the Filters pane by right-clicking on the data field and selecting Add to Context.

Tableau Order of Operations - Step 3

Step 4: Similarly, you may apply the dimensions filters to your dataset. It can be done by right-clicking a dimension in the Tableau view and choosing the filter options on the screen.

The filter screen provides you the choice of defining a general or wildcard or conditional or Top N dimension filter to your dataset.

Tableau Order of Operations - Step 4

Step 5: If you intend to apply filters to any measures in your dataset, such as SUM, AVG, MIN, MAX, etc., then you can apply measures filters in the Tableau view.

Tableau Order of Operations - Step 5

Step 6: Apply Table Calculation Filters to the Tableau view, such as trend lines or reference lines.

Tableau Order of Operations - Step 6

Note: You can’t change the order of operations in Tableau as it’s an internal algorithm, but by defining the activities aligned to the order of operations, you may ensure the results are in line with your expectations.

Tableau order of operations parameters don’t impact the filter operations directly.

Examples

In this section, we will demonstrate different scenarios where you can use Tableau order of operations.

Example #1

In this example, we will demonstrate converting a Dimension Filter to a Context Filter using the Online Sales dataset. As part of this demo, we will create two-dimension filters using the General and Top tab. Notice how Tableau executes these filters simultaneously when we first want to apply the General filter and then the Top N filter based on the results from the General filter. For this to happen, we convert the dimension filter to a context filter. The Online Sales dataset contains information about the sales details across different regions and product categories.

To perform an order of operation in Tableau, follow the instructions outlined below:

Step 1: Import your dataset into the Tableau interface using the File Navigator in Tableau Desktop.

Tableau Order of Operations - Example 1 - Step 1

Step 2: Drag Total Revenue to the Columns shelf. Similarly, drag and drop the Region and Product Name to the Rows shelf.

Tableau Order of Operations - Example 1 - Step 2

Step 3: Drag the Region field from the Data pane to the Filters pane. In the Filter screen, click on None.

Tableau Order of Operations - Example 1 - Step 3

Select the North America checkbox and click on OK to create a general dimension filter.

Tableau Order of Operations - Example 1 - Step 3 - North America

Step 4: Now click on the Sort icon to sort the data in descending order. Tableau will sort the data, as shown below.

Tableau Order of Operations - Example 1 - Step 4

Step 5: Drag the Product Name from the Data pane to the Filters pane. Navigate to the Top tab to create a Top 10 filter to display Top Product Names based on Total Revenue. Click OK.

Tableau Order of Operations - Example 1 - Step 5

Tableau will display the Top 10 product names based on total revenue. If you notice, the Apple iPad Air that was included previously as part of the Top 10 Product Names has now been replaced with the Garmin Forerunner 945..

Tableau Order of Operations - Example 1 - Step 5 - product name

Note that both top and general filters are dimension filters. Hence, when you apply them simultaneously, they follow the order of operations. To ensure your general dimensions filter is in line with the top filter, you need to use context filters as they come up in the order of operations compared to dimensions filters.

Step 6: Right-click on the Region in the Filters pane and choose Add to Context.

Tableau Order of Operations - Example 1 - Step 6

Now, the context filter you had added to the Tableau view will take precedence over the dimensions filter, and you will see the below result as per the order of operations.

Tableau Order of Operations - Example 1 - Step 6 - order

Example #2

In this example, we will demo converting a Tableau calculation to a FIXED Level of Detail expression, i.e., Tableau order of operations lod using the Dataset salary 2024. It contains data developer salaries and employment attributes that offer valuable insights into the evolving landscape of data developers.

To convert a Tableau calculation to a FIXED Level of Detail expression, i.e., Tableau order of operations lod in Tableau public, follow the instructions outlined below:

Step 1: Import the Dataset salary 2024 dataset in Tableau public desktop using File – Open.

Example 2 - Step 1

Step 2: In a new worksheet, drag the Salary in USD and Job Title to the Columns shelf and the Rows shelf, respectively.

Example 2 - Step 2

Step 3: Sort the view by clicking on the Sort Descending icon.

Example 2 - Step 3

Step 4: Right-click on the Salary in USD and select Quick Table Calculation – Percent of Total.

Example 2 - Step 4

Step 5: Navigate to Analysis – Show Mark Labels.

Example 2 - Step 5

Tableau will display percentage values in the view.

Example 2 - Step 5 - percentage

Step 6: Right-click on Job Title and select Show Filter.

Example 2 - Step 6

Tableau will display the data filter values.

Example 2 - Step 6 - Data Display

Step 7: Uncheck the Data Engineer value from the filter.

Example 2 - Step 7

Step 8: Navigate to Analysis – Create Calculated Field to create an order of operations calculated field.

Example 2 - Step 8

Step 9: In the Calculation Editor, specify the logic to create the order of operations lod using the FIXED function.

Tableau Order of Operations - Example 2 - Step 9

Step 10: Drag the newly created Tableau order of operations calculated field to the Columns shelf.

Tableau Order of Operations - Example 2 - Step 10

Step 11: Right-click on FixedLOD and choose Format.

Tableau Order of Operations - Example 2 - Step 11

Step 12: In the Format pane, choose Numbers – Percentage.

Tableau Order of Operations - Example 2 - Step 12

Step 13: Repeat the same step for Pane. As you can see by adding the order of operations using the FIXED function, you have accurately displayed the view.

Tableau Order of Operations - Example 2 - Step 13

Example #3

In this example, we have demonstrated another scenario of converting a table calculation to a FIXED Level of details expression, i.e., Tableau order of operations lod using the Diamond dataset, which contains diamond prices and the different variables associated with each diamond.

To demonstrate the order of operation in Tableau public, follow the steps outlined below:

Step 1: Import the Diamond dataset into the Tableau Desktop interface using the File Navigator.

Tableau Order of Operations - Example 3 - Step 1

Step 2: Drag the Clarity to the Rows shelf and Price to the Columns shelf. Click on the Sort Descending icon to sort the view in descending order based on the prices.

Tableau Order of Operations - Example 3 - Step 2

Step 3: Right-click on the Price and choose Quick Table Calculation – Percent of Total.

Tableau Order of Operations - Example 3 - Step 3

Tableau will display the percentage values, as shown below.

Tableau Order of Operations - Example 3 - Step 3 - Percentage

Step 4: Right-click on Clarity and select Show Filter. Tableau will display the Filter values, as shown below. 

Tableau Order of Operations - Example 3 - Step 4

Step 5: Uncheck the VVS2 from the filter values.

Tableau Order of Operations - Example 3 - Step 5

Step 6: Create a Tableau order of operations calculated field using the FIXED level of details expression.

Tableau Order of Operations - Example 3 - Step 6

Step 7: Drag the operations calculated field to the Columns shelf. Format the values by selecting Numbers – Percentage in the Format pane.

Now, you can see that by converting the Table Calculation to FIXED Level of Details expression, your view shows the correct values. 

Tableau Order of Operations - Example 3 - Step 7

Common Order of Operations Problems

At times, you may experience unexpected output in your Tableau view when you apply filters. It is due to the order in which Tableau executes or applies filters to your dataset. For example, when you apply two different dimension filters to your dataset, the results may vary. Similarly, if you apply a Table Calc Filter before Dimensions filters, the results will be different compared to what you expect. If you apply filters to your dataset before any calculation, then Tableau won’t consider the data points. 

Tableau applies the filters in the below order, i.e., extract filter – Data Source Filters – Context Filters – Dimensions Filters – Measure Filters – Table Calc Filters.

Tableau Order of Operations - Filters

Importance Things to Note

  • Tableau Order of Operations gets executed in a definite order from top to bottom.
  • The latest date filter is global to the workbook while context filters apply per worksheet in the Tableau order of operations.

Frequently Asked Questions (FAQs)

1. What happens if I apply filters or calculations at different stages of the order of operations?

If you apply filters or calculations at different stages of the order of operations, you may experience unexpected outputs in your data. For example, if you perform a calculation followed by a filter or vice versa, a filter will be applied to the calculated results. However, if you first apply a filter and then perform calculations, only the filtered result will be considered for calculation. Hence, the data results will vary.

2. How can I troubleshoot issues related to the order of operations in Tableau?

To troubleshoot issues related to the order of operations in Tableau, consider some of the tips outlined below:

• Ensure you apply filters according to the Tableau order of operations.
• Validate the outputs from filters and their impact on calculations to ensure the desired outcomes have been tested.
• Understand the impact of context filters, measures filters, and dimensions filters on your dataset.

3. How does Tableau’s order of operations compare to other data visualization tools?

Every data visualization tool has its internal algorithm model considering the sequence order to perform the data filtering and calculations. As far as Tableau is concerned, it has a specific order of operations compared to the other visualization tools.

4. Does the order of operations change when using Tableau Server or Tableau Online?

No, the order of operations doesn’t change regardless of whether you use Tableau Server or Tableau Online. It is executed standard across all the Tableau products including Tableau Desktop, Server, or Online.

Download Template

This article must be helpful to understand the Tableau Order of operation, with its formula and examples. You can download the template here to use it instantly.

Guide to What is the Tableau Order of operation. We explain how to do the order of operations in Tableau with examples and points to note. You can learn more from the following articles –

Tableau Bullet Graph

Tableau ZN

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *