What is LOD Calculations in Tableau?
Wrestling with calculations that don’t quite match the detail level of your Tableau view can be a huge headache. Level of Detail (LOD) calculations are Tableau's powerful solution to this problem, letting you control exactly how your data is aggregated. This article will walk you through what LOD calculations are, the different types you can use, and practical examples to get you started.
What Exactly is "Level of Detail"?
Before diving into the calculations themselves, it's essential to understand the concept of "level of detail" in a Tableau worksheet. Simply put, the level of detail (or LOD) is determined by the dimensions you add to your view. A more detailed view has more dimensions, making it more granular.
For instance, if you drag the Sales measure to your Rows shelf and the Region dimension to your Columns shelf, your viz will show four bars - one for the total sales in each region. The level of detail in this view is Region.
Now, if you also drag the Category dimension to the Columns shelf, the view will become more granular. You’ll now see a bar for each combination of Region and Category (e.g., "East - Technology," "West - Furniture," etc.). The level of detail is now Region and Category.
Standard calculations in Tableau respect the view's LOD. But what if you want to perform a calculation at a different level of detail? For example, what if you want to compare each Category's sales to the total sales for its entire Region? For that, you need an LOD calculation.
When and Why to Use LOD Calculations
LOD calculations liberate you from the constraints of your view's current level of detail. They allow you to compute values at a coarser or finer level of granularity than the worksheet you're building.
Common scenarios for LOD calculations include:
- Comparing an individual value to a total: Calculate the percentage of total sales each state contributes, even as you filter by different product categories.
- Analyzing different cuts of your data: Find the average sales per customer within each region, without having to display every single customer in your view.
- Customer Cohort Analysis: Find each customer's first purchase date and use it to group them, allowing you to see how different cohorts behave over time.
- Proportional Analysis: Determine what percentage of a regional market a specific store represents.
There are three types of LOD calculations in Tableau, each defined by a specific keyword: FIXED, INCLUDE, and EXCLUDE. Let's break them down one by one.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
The Three Types of LOD Calculations Explained
The general syntax for an LOD expression is straightforward, following this structure:
{ KEYWORD [Dimension 1], [Dimension 2] : AGGREGATE([Measure]) }
Curly braces { } enclose the entire expression, letting Tableau know it's an LOD calculation.
1. FIXED LOD Calculations
FIXED is arguably the most powerful and commonly used LOD expression. It computes a value using only the dimensions specified in the calculation formula, completely ignoring the other dimensions in your view.
Use Case: You want to calculate the total sales for each customer and use that value consistently across different visualizations, regardless of what other dimensions (like Order Date or Product Category) are present.
Example: Finding Each Customer's First Order Date
Imagine you want to analyze customer cohorts based on when they made their first purchase. You need a calculation that finds the minimum order date for each customer and "fixes" that date to their profile.
- Open the Calculated Field editor by clicking the dropdown arrow in the Data pane and selecting "Create Calculated Field."
- Name your calculation something like "Customer First Order Date."
- Enter the following formula:
{ FIXED [Customer ID] : MIN([Order Date]) }
Now you have a new field that stores the very first order date for every customer. If you pull Customer ID, Order Date, and your new Customer First Order Date field into a table, you'll see a list of all orders. The Order Date will be different for each row, but the Customer First Order Date will remain the same for all orders placed by that same customer.
A key thing to remember about FIXED is that it happens before regular dimension filters are applied. If you want a filter to affect a FIXED calculation, you must "add it to context" by right-clicking the filter in the Filters shelf and choosing that option.
2. INCLUDE LOD Calculations
INCLUDE LOD calculations compute a value using the dimensions currently in the view, plus any additional dimensions you specify in the formula. This is useful when you want to calculate something at a finer level of detail than what is shown.
Use Case: Your view shows the total sales by state, but you want to see the average of sales per city within each of those states. You want to INCLUDE the City dimension in your calculation without actually adding it to your main view.
Example: Calculating Average Order Size Per Region
Let’s say you have a simple bar chart showing total SUM(Sales) by Region. If you try to get the average sale, using AVG(Sales) would give you the average transaction value, not the average total sales for each order.
To calculate the average total value per order, you need to first sum up the sales for each unique Order ID and then find the average of those sums.
- Create a view with Region on the Rows shelf.
- Create a new Calculated Field and name it "Average Order Size."
- Enter the following
INCLUDEcalculation:
{ INCLUDE [Order ID] : SUM([Sales]) }
This internal calculation figures out the total sales amount for every single Order ID.
- Drag this new field to your view, and change its aggregation from SUM to Average (AVG).
Your view will now show the average total sales a customer spends per order within each region. The calculation included the Order ID to figure out the sum at that granular level, even though Order ID wasn't visible in your final chart.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
3. EXCLUDE LOD Calculations
EXCLUDE LOD calculations do the opposite of INCLUDE. They subtract, or EXCLUDE, a dimension from your calculation, computing the aggregate at a coarser level of detail than what your view is currently showing.
Use Case: Your view shows daily sales trends, but you want to display a reference line showing the average daily sales for the entire month on the same chart. You would want to EXCLUDE the "Day" part of the date from the reference line calculation.
Example: Comparing a Category's Sales to its Region's Total
Imagine your worksheet is broken down by Region and also by Category. This means your SUM(Sales) reflects the sales for that specific combination (e.g., Central - technology).
What if, on that same row, you want to show the total sales for the entire Central region to quickly calculate a percent of total? You need a calculation that sums the sales but ignores (EXCLUDES) the Category dimension.
- Create a view with Region and Category on the Rows shelf.
- Drag Sales to the Text mark to show the sales for each combination.
- Create a new Calculated Field named "Regional Sales Total."
- Enter this EXCLUDE formula:
{ EXCLUDE [Category] : SUM([Sales]) }
You will now see the SUM(Sales) for each Category alongside the total sales for that Category's entire region. The "Regional Sales Total" calculation acknowledges the Region in the view but specifically ignores the Category, giving you access to two different levels of detail in one row. From here, you could easily create a third calculation, SUM([Sales]) / SUM([Regional Sales Total]), to find the percentage contribution.
Final Thoughts
Level of Detail calculations unlock a new depth of analysis in Tableau, letting you answer complex questions by controlling the context of your aggregations. Mastering FIXED, INCLUDE, and EXCLUDE gives you the flexibility to build reports that would otherwise be impossible without reshaping your source data.
Of course, becoming proficient with tools like Tableau, learning specific syntax, and understanding data structures takes a significant investment of time. At Graphed, we've automated this entire process. We allow you to connect your data sources and simply ask in plain English for the insights you need - no complex calculations required. Instead of building a series of FIXED and EXCLUDE calculations, you can just ask, "show me how much each category's sales contributed to its region's total," and get an interactive dashboard instantly. Try Graphed for free and spend your time acting on insights, not writing formulas.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.