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
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.
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:
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.
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:
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.
Tableau offers three types of LOD expressions. Each type uses a different keyword and works with the view in a different way.
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.
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.
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.
Many learners mix up these three types. The table below shows the key differences in one place.
| Feature | FIXED | INCLUDE | EXCLUDE |
| What it does | Uses only the dimensions you list | Adds dimensions to the view | Removes dimensions from the view |
| Depends on the view? | No | Yes | Yes |
| Level of detail | Independent | Finer than the view | Coarser than the view |
| Reacts to dimension filters? | No, unless the filter is a context filter | Yes | Yes |
| Works without the dimension in the view? | Yes | Yes | No, the dimension must be in the view |
| Typical use case | Customer lifetime sales, cohorts, percent of total | Average of a finer level, such as sales per customer | Compare 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.
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.
The following Tableau LOD examples solve problems that analysts face every day. Each one uses the Superstore data.
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.
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.
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.
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.
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.
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:
Now look at what this order means for you.
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.
Analysts often ask which tool to pick. Each one has a purpose. The table below compares LOD vs table calculations and regular calculated fields.
| Feature | LOD Expressions | Table Calculations | Regular Calculated Fields |
| Where Tableau computes it | In the data source query | In Tableau, on the results already in the view | Row 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 partitioning | Aggregate fields depend on the view. Row-level fields do not. |
| Can create a dimension? | Yes | No | Yes, at row level |
| Best for | Multi-level questions, cohorts, fixed totals | Running totals, rank, moving average, percent difference | Simple math, text, dates and logic |
| Main risk | Slow queries on large data | Breaks when you change the view | Cannot 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.
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.
Follow these habits to write clean and fast LOD expressions.
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.