Tableau LOD Expressions

LOD Expressions in Tableau: A Tutorial With Examples

Yash Soni
November 23rd, 2026
5
5: 00 Minutes

Have you ever tried to show customer-level numbers inside a region-level chart and Tableau gave you the wrong answer? That problem is exactly why Tableau LOD expressions exist.

Level of detail expressions in Tableau let you control how Tableau aggregates data. You decide the level of detail and the view does not decide it for you. Tableau introduced them in version 9.0 and they are now a core skill for every analyst.

In this blog, you will learn what LOD expressions are, how the syntax works and when to use each type. You will also see step-by-step examples, filter rules and mistakes to avoid.

Read Also: Power BI vs. Tableau

What Are LOD Expressions in Tableau?

Level of Detail expressions in Tableau let you compute values at a specific data granularity, either coarser, finer, or completely independent of the level of detail in your visualization.

Here is a simple way to think about it. A normal aggregation follows the dimensions in your view. If your view shows Region, SUM([Sales]) returns sales by region. An LOD expression can ignore that view and return sales by customer, by month, or for the whole table.

Tableau computes LOD expressions in the data source query. They are not table calculations. They can return a dimension or a measure and you wrap them in curly braces.

Why Are LOD Expressions Important in Tableau?

Business questions rarely match the level of your chart. LOD expressions close that gap. They help you answer questions that need more than one level of detail in the same view.

Here are the main reasons analysts use them:

  • They solve multi-level questions: You can compare a region's sales to the company total in one chart.
  • They reduce workarounds: Before Tableau 9.0, analysts used blends, extra sheets and tricky table calculations. LOD expressions replace many of those.
  • They create new dimensions: You can bin customers by lifetime sales or group them by first purchase date.
  • They support more accurate analysis: You can calculate measures at the required level of detail, helping avoid incorrect aggregations when comparing data across different levels.

You will also see LOD expressions in Tableau certification exams and data analyst interviews. If you want to move past basic charts, you need this skill.

Understanding LOD Expression Syntax

The LOD expression syntax is short and predictable. Every expression follows this pattern:

{ [LOD TYPE] [dimension 1], [dimension 2] : [aggregate expression] }

The syntax has four parts:

  1. Curly braces: They tell Tableau that this is an LOD expression.
  2. LOD keyword: You write FIXED, INCLUDE, or EXCLUDE.
  3. Dimension declaration: You list one or more dimensions, separated by commas.
  4. Aggregate expression: You write an aggregation such as SUM([Sales]) or MIN([Order Date]).

Here is a basic example:

{ FIXED [Customer Name] : SUM([Sales]) }

This expression calculates total sales for each customer. It does this no matter which dimensions are in the view.

You can also write a table-scoped LOD expression. It has no dimensions, so it returns one value for the whole data source:

{ FIXED : SUM([Sales]) }

You can also create a table-scoped LOD expression without specifying FIXED, INCLUDE, or EXCLUDE. For example, { SUM([Sales]) } calculates total sales at the table level.

Types of LOD Expressions in Tableau

Tableau offers three types of LOD expressions. Each type uses a different keyword and works with the view in a different way.

1. FIXED LOD Expressions

A Tableau FIXED LOD calculates a value using only the dimensions you list. It ignores every other dimension in the view.

{ FIXED [Region] : SUM([Sales]) }

This returns total sales per region. If you add State or City to the view, the value stays the same for each region.

Use FIXED when you need a stable value. Common uses include customer lifetime value, first purchase date and percent of total.

2. INCLUDE LOD Expressions

A Tableau INCLUDE LOD adds dimensions to the level of detail that the view already has. The calculation becomes more granular than the view.

{ INCLUDE [Customer Name] : SUM([Sales]) }

Suppose your view shows Region. This expression calculates sales per customer inside each region. You can then wrap it in AVG() to find the average sales per customer for each region.

3. EXCLUDE LOD Expressions

A Tableau EXCLUDE LOD removes dimensions from the level of detail that the view has. The calculation becomes less granular than the view.

{ EXCLUDE [Region] : SUM([Sales]) }

Suppose your view shows Region and Month. This expression returns total sales for each month across all regions. You can use it to compare each region against the monthly total.

FIXED vs. INCLUDE vs. EXCLUDE: Key Differences

Many learners mix up these three types. The table below shows the key differences in one place.

FeatureFIXEDINCLUDEEXCLUDE
What it doesUses only the dimensions you listAdds dimensions to the viewRemoves dimensions from the view
Depends on the view?NoYesYes
Level of detailIndependentFiner than the viewCoarser than the view
Reacts to dimension filters?No, unless the filter is a context filterYesYes
Works without the dimension in the view?YesYesNo, the dimension must be in the view
Typical use caseCustomer lifetime sales, cohorts, percent of totalAverage of a finer level, such as sales per customerCompare a part to its group

Here is a simple rule you can remember: Choose FIXED when the answer must not change with the view. Choose INCLUDE when you need more detail. Choose EXCLUDE when you need less detail.

How to Create LOD Expressions in Tableau: Step-by-Step Guide

To understand how FIXED LOD expressions work in practice, let's use Tableau's Sample Superstore dataset to calculate the first purchase date for each customer. This example demonstrates how you can identify customer acquisition periods without depending on the dimensions currently displayed in your visualization.

By calculating the minimum order date for each customer, you can identify when each customer first purchased and use that information to build a customer acquisition or cohort analysis.

Step 1: Connect to your data: Open Tableau Desktop and select Sample - Superstore on the Connect page. Open a new worksheet.

Step 2: Open the calculated field window: Click the drop-down arrow in the Data pane. Then select Create Calculated Field.

Step 3: Name the field: Type First Purchase Date as the name.

Step 4: Write the expression: Type the following formula:

{ FIXED [Customer Name] : MIN([Order Date]) }

Step 5: Check and save: Wait for the message that says the calculation is valid. Then click OK.

Step 6: Build the view: Drag First Purchase Date to Columns and choose the Year level. Drag Customer Name to Rows and change the measure to Count Distinct. Now you can see how many customers joined in each year.

Tableau places the new field in the Data pane. A FIXED expression that returns a dimension appears under Dimensions. You can use it like any other dimension.

Practical Examples and Real-World Use Cases of LOD Expressions

The following Tableau LOD examples solve problems that analysts face every day. Each one uses the Superstore data.

Example 1: Customer Lifetime Sales

You want to know how much each customer has spent in total.

{ FIXED [Customer Name] : SUM([Sales]) }

Create bins using the Customer Lifetime Sales measure to group customers into spending ranges. Then use COUNTD([Customer Name]) to count the distinct customers in each group.

Example 2: Percent of Total Sales

You want to show each region's share of company sales.

SUM([Sales]) / ATTR({ FIXED : SUM([Sales]) })

The FIXED expression calculates the overall sales total independently of the dimensions displayed in the view. The SUM([Sales]) calculation returns the sales for the current region, and dividing the two values gives you that region's contribution to total sales.

One important behavior to understand is how this calculation responds to filters. If you apply a regular Region dimension filter, the FIXED grand total still includes all regions. This can affect the percentage displayed in your visualization. Understanding this behavior helps you decide whether to use a context filter or a different LOD expression.

Example 3: Average Sales per Customer by Region

Your view shows Region. You want the average of customer totals, not the average of order lines.

AVG({ INCLUDE [Customer Name] : SUM([Sales]) })

Tableau first sums sales for each customer. Then it averages those sums for each region.

Example 4: Region Compared to the Monthly Total

Your view shows Month and Region. You want each region's share of that month.

SUM([Sales]) / ATTR({ EXCLUDE [Region] : SUM([Sales]) })

The EXCLUDE part removes Region, so it returns the total for each month.

Example 5: Cohort Analysis

You want to group customers by the year they first ordered.

YEAR({ FIXED [Customer Name] : MIN([Order Date]) })

Then you can track how each cohort spends over time. This is one of the most popular uses of Tableau LOD expressions.

Understanding LOD Expressions and Filters in Tableau

Filters cause the most confusion, so this section matters. The behavior depends on the order of operations in Tableau. Tableau applies filters and calculations in this order:

  1. Extract filters
  2. Data source filters
  3. Context filters
  4. FIXED LOD expressions
  5. Dimension filters
  6. INCLUDE and EXCLUDE LOD expressions
  7. Measure filters
  8. Table calculations

Now look at what this order means for you.

  • FIXED expressions run before dimension filters: A regular dimension filter does not change a FIXED result. If you filter Region to West, a FIXED total still includes all regions.
  • Context filters run before FIXED expressions: If you want a filter to affect a FIXED expression, right-click the filter and choose Add to Context.
  • INCLUDE and EXCLUDE run after dimension filters: They respond to regular dimension filters, so they work like normal aggregations.
  • Measure filters run after all LOD expressions: They filter the results of your calculation.

Here is a quick example. You build a percent of total with a FIXED grand total and you filter the view to one region. The percent will look small because the FIXED total still includes every region. To fix it, add the filter to context, or switch to an EXCLUDE expression.

LOD Expressions vs. Table Calculations vs. Regular Calculated Fields

Analysts often ask which tool to pick. Each one has a purpose. The table below compares LOD vs table calculations and regular calculated fields.

FeatureLOD ExpressionsTable CalculationsRegular Calculated Fields
Where Tableau computes itIn the data source queryIn Tableau, on the results already in the viewRow level in the data source, or aggregate level in the view
Depends on the view layout?FIXED does not. INCLUDE and EXCLUDE do.Yes, it depends on addressing and partitioningAggregate fields depend on the view. Row-level fields do not.
Can create a dimension?YesNoYes, at row level
Best forMulti-level questions, cohorts, fixed totalsRunning totals, rank, moving average, percent differenceSimple math, text, dates and logic
Main riskSlow queries on large dataBreaks when you change the viewCannot change the level of detail

Use a table calculation when you need ranking, running totals, or moving averages. Use an LOD expression when you need a value at a specific level, no matter how the view looks. Use a regular calculated field when a simple formula does the job.

Note that LOD expressions need data sources that support them. Most major databases work well, but a few connection types do not. Check Tableau Help for your data source before you build.

Common Mistakes to Avoid When Using LOD Expressions

These mistakes cost analysts hours. Avoid them and your work will go faster.

1. Forgetting that dimension filters do not affect FIXED: Add the filter to context when you need it to apply.

2. Leaving out the aggregation: The part after the colon must be an aggregate, such as SUM or MIN. A raw field will return an error.

3. Double counting: A FIXED customer total repeats on every order row. If you sum that field in the view, you will inflate the numbers. Use AVG, MIN, or MAX on it, or place the field as a dimension.

4. Using LOD when a simple aggregate works: If the view already has the right level, skip the LOD expression. Simple fields calculate faster.

5. Choosing the wrong type: Beginners often use FIXED for everything. Use INCLUDE or EXCLUDE when the answer must respond to the view.

6. Excluding a dimension that is not in the view: EXCLUDE only works when the dimension already appears in the view.

7. Using high-cardinality dimensions without a reason: Fixing on Order ID or Customer ID across millions of rows can slow your dashboard.

8. Ignoring data relationships and joins: The way tables are related or joined can affect the data available to an LOD calculation. Incorrect relationships or join configurations may produce unexpected results, including duplicated records or inflated measures. Check the underlying data model and validate your calculation against the expected results before using it in a dashboard.

Best Practices for Using LOD Expressions

Follow these habits to write clean and fast LOD expressions.

  • Start with the question: Write down the level of detail you need before you write the formula.
  • Pick the simplest type: Use FIXED for stable values. Use INCLUDE or EXCLUDE when the view should drive the result.
  • Use clear names. A name like Customer Lifetime Sales helps your whole team.
  • Test with a simple table: Put the LOD field in a text table next to the raw numbers. Check that the values match what you expect.
  • Use context filters on purpose: Add a filter to context only when you want it to change FIXED results. Remember that context filters can affect performance.
  • Keep the dimension list short: More dimensions mean more rows to process.
  • Test extract performance: Compare live connections and extracts to determine which performs better for your data source and calculations.
  • Add comments. Use // inside the formula to explain the logic.
  • Review the order of operations: When a result looks wrong, check where your filter sits in the pipeline.

Wrapping Up

Tableau LOD expressions give you control over the level of detail in every calculation. FIXED gives you stable values. INCLUDE adds detail and EXCLUDE removes detail. Once you know the syntax and the order of operations, you can answer questions that normal calculations cannot.

Start small. Build the first purchase date example from this guide. Then try percent of total and average sales per customer. Each example will make the next one easier.

Which LOD expression will you build first? Open Tableau, load Superstore and try it today.

About the Author
Yash Soni | igmGuru
About the Author

Yash Soni is a certified business intelligence and data analytics professional with experience across retail and finance analytics. His expertise includes data modeling, dashboard development, reporting, and KPI analysis, using tools such as Power BI, Tableau, and SQL. Apart from his job, he loves to write content so he can engage with new learners and share his knowledge with them.

Drop Us a Query
Fields marked * are mandatory
×

Your Shopping Cart


Your shopping cart is empty.