How to Create Level of Detail in Tableau
If you've spent any time working in Tableau, you've probably faced a classic dilemma: you need to calculate a value at one level of detail but display your chart at another. This is where Level of Detail (LOD) calculations come in, giving you precise control over the granularity of your analysis. This article breaks down Tableau's three types of LOD expressions - FIXED, INCLUDE, and EXCLUDE - and shows you how to use them with practical examples to answer more complex business questions.
What Are Level of Detail (LOD) Calculations?
In Tableau, the "level of detail" refers to the granularity of your data as determined by the dimensions included in your view. For instance, if you drag the Region dimension to your worksheet, your level of detail is "Region." If you then add the State dimension, your level of detail becomes more granular: "Region and State." All standard calculations, like SUM(Sales), are computed at the level of detail of the worksheet.
But what if you need to know the total sales for an entire region and compare it to the sales of a specific state within that region, all in the same chart? Standard aggregations can't do this. Level of Detail calculations solve this problem by letting you create calculations that are independent of the view's current level of detail. They allow for multi-level analysis in a single visualization.
There are three main types of LOD expressions:
- FIXED: Calculates a value at a specified level of detail, regardless of what dimensions are in the view.
- INCLUDE: Calculates a value using the view's level of detail plus any additional dimensions specified in the calculation.
- EXCLUDE: Calculates a value at a less granular level than the view by subtracting, or "excluding," specific dimensions.
The Basic Syntax of an LOD Expression
Before we dive into examples, let's look at the basic structure of an LOD expression. They all follow the same format and are always enclosed in curly braces {}.
{ <LOD_KEYWORD>, [Dimension 1], [Dimension 2]... : AGGREGATE([Measure]) }
Syntax Breakdown:
- { } (Curly Braces): Tell Tableau you are creating an LOD calculation. Always start and end with these.
- LOD_KEYWORD: This is where you'll type
FIXED,INCLUDE, orEXCLUDE. - [Dimension(s)]: Here you declare one or more dimensions that will define the level of detail for the calculation. This part is followed by a colon.
- AGGREGATE([Measure]): This is the aggregation you want to perform, such as
SUM([Sales])orAVG([Profit]).
Free PDF Guide
AI for Data Analysis Crash Course
Learn how to get AI to do data analysis for you — the best tools, prompts, and workflows to go from raw data to insights without writing a single line of code.
FIXED LOD: Calculating at a Specific, Unchanging Level
The FIXED LOD expression is arguably the most common and powerful. It computes a value using only the dimensions you specify in the formula, completely ignoring other dimensions in the view. This is incredibly useful for establishing a baseline or comparing an individual value against a fixed total.
Let's say you want to find the total sales for each customer across all of their orders and see that total next to each individual order they placed.
Example: Finding Each Customer's Total Lifetime Sales
In this scenario, you want a calculation that finds the sum of sales for each customer, regardless of the individual orders or products shown in your view.
Step 1: Create the Calculated Field
- Right-click in the Data Pane and select Create Calculated Field.
- Name your calculation something clear, like
Total Sales per Customer. - Enter the following formula:
{ FIXED [Customer Name] : SUM([Sales]) }
This formula tells Tableau: "For each unique Customer Name, calculate the total sum of Sales."
Step 2: Use the Calculation in a View
- Drag
Customer NameandOrder IDto the Rows shelf. - Drag the standard
Salesmeasure to the Text mark. This shows the sales for each individual order. - Now, drag your new
Total Sales per Customercalculated field onto the view, right next to theSUM(Sales)aggregation.
You will see a table where each row represents an order. The first sales column shows the amount for that specific order, while the second column shows the total sales for that customer across all their orders. That fixed value repeats for every order made by the same customer, making it perfect for calculating things like a customer's rank or their largest order as a percentage of their lifetime value.
A Quick Note on Filters: FIXED LOD calculations are evaluated before regular dimension filters are applied in Tableau's order of operations. This means if you filter by Product Category, the FIXED calculation will still show the customer's total sales across all categories. To make a FIXED LOD respect a filter, you have to right-click the filter and select Add to Context. Context filters are applied before FIXED calculations.
INCLUDE LOD: Adding More Granularity to Your View
The INCLUDE LOD expression computes a value using the dimensions currently in the view, plus any additional dimensions you specify in the calculation. It allows you to calculate at a finer level of detail and then present it in a more aggregated view.
This is perfect for calculating things like an average of a sub-total. For example, what is the average order size per region? If you just dropped AVG([Sales]) into a view with Region, you'd get the average sales per line item, not per order.
Example: Calculating Average Order Sales by Region
You want to show a visualization with only the Region on display, but you need the value to be the average of each order's total, not the average of each product's sales.
Step 1: Create the Calculated Field
- Create a new calculated field and name it
Sales per Order. - Enter the following formula:
{ INCLUDE [Order ID] : SUM([Sales]) }
This formula tells Tableau: "For the dimensions currently in the view (like Region), also include Order ID. For each unique combination, calculate the SUM(Sales)." The result is a value equal to the total sales for each order.
Step 2: Use the Calculation in the View
- Drag
Regionto the Columns shelf. - Drag your new
Sales per Ordercalculated field to the Rows shelf. - By default, Tableau will likely aggregate it as a
SUM(). Right-click the pill in the Rows shelf, go to Measure, and change the aggregation to Average.
Now, your bar chart displays the average of the order totals for each region. You performed a calculation at the Region and Order ID level of detail but displayed the aggregated result at just the Region level. This simple technique unlocks averages of averages, averages of totals, and many other complex analytical questions.
EXCLUDE LOD: Removing Granularity from Your View
The EXCLUDE LOD expression is the opposite of INCLUDE. It calculates a value at a less granular level by removing, or "excluding," specific dimensions that are currently in the view. It allows you to compute a broader total while still keeping the finer-grained detail in your visualization for context.
A classic use case is comparing a sub-category's performance to the total of its parent category.
Free PDF Guide
AI for Data Analysis Crash Course
Learn how to get AI to do data analysis for you — the best tools, prompts, and workflows to go from raw data to insights without writing a single line of code.
Example: Comparing Sub-Category Sales to Category Totals
You want to build a table showing sales for each Sub-Category. Alongside each sub-category, you also want to display the total sales for its parent Category to easily see its contribution.
Step 1: Create the Calculated Field
- Create a new calculated field and name it
Category Sales Total. - Enter the following formula:
{ EXCLUDE [Sub-Category] : SUM([Sales]) }
This formula tells Tableau: "Even though Sub-Category is in my view, ignore it and give me the SUM(Sales) for the next highest level up (in this case, just Category)."
Step 2: Use the Calculation in the View
- Drag
Categoryand thenSub-Categoryto the Rows shelf. - Drag the standard
Salesmeasure to the Text mark to show sales for each sub-category. - Now, drag your
Category Sales Totalcalculated field to the view, next toSUM(Sales).
Your table now shows each Sub-Category, its individual sales, and the total sales for the Category it belongs to. For example, for every sub-category within Furniture (Bookcases, Chairs, etc.), the same total Furniture sales value will be displayed. This allows you to quickly create another calculated field like SUM([Sales]) / SUM([Category Sales Total]) to find the percent-of-total contribution for each sub-category.
Final Thoughts
Level of Detail expressions like FIXED, INCLUDE, and EXCLUDE are essential skills for any serious Tableau user. They move you beyond simple aggregations and empower you to answer nuanced, multi-layered questions about your data, giving you the flexibility to analyze values at a granularity separate from your visualization's structure.
As powerful as these features are, we know mastering them requires patience and practice. That steep learning curve is exactly why we built Graphed. We provide a platform where marketing and sales teams can connect their data sources and create real-time dashboards using simple, natural language. Instead of spending hours learning complex formulas and configurations, you can just ask questions like "Show me a chart of our total sales by region, and compare it to each customer's lifetime value," and get the answers you need in seconds, freeing you up to focus on strategy instead of report-building.
Related Articles
How to Sell Mockups on Etsy: A Complete Guide for Digital Sellers
Learn how to sell mockups on Etsy — from creating your first product to pricing, listing optimization, and driving consistent sales.
The Bookmarks Market: Trends, Opportunities, and How to Win on Etsy
The bookmarks market is growing. Discover the trends, buyer personas, and strategies helping Etsy sellers win in this profitable niche.
How to Start a Bookmark Business on Etsy: A Step-by-Step Guide
Thinking of starting a bookmark business? Learn how to design, price, and sell bookmarks on Etsy for steady creative income.