Insights

Tableau Level of Detail: FIXED, INCLUDE, EXCLUDE

Your dashboard says average sales per customer is one number. Finance says it is another. Both are right. The view’s grain does not match the question.

By Pniel AnalyticsNovember 30, 2026 15 min read
Tableau Level of Detail: FIXED, INCLUDE, EXCLUDE — Pniel Analytics illustration

Your dashboard says average sales per customer is one number. Finance says it is another. Both are right. The view’s grain does not match the question.

Tableau calculates most things at the level of the dimensions in the view. Add Segment and the math changes. Add Region and it changes again. Level of detail (LOD) expressions let you set the grain yourself, so the number answers the question you asked. This guide uses the Sample - Superstore data that ships with Tableau. Each case gives the business question, the calc, how to build it and one pitfall.

Pniel Analytics builds Tableau dashboards for operations, finance and program leaders. When a number is wrong, we check the grain first.

TL;DR

  • An LOD expression sets the grain of a calculation, so it no longer depends on which dimensions sit in the view.
  • Use FIXED for a stable value, INCLUDE to go finer than the view, and EXCLUDE to go coarser.
  • FIXED ignores ordinary dimension filters. Add a context filter when the filter should apply.
  • LODs cost performance and make debugging harder. Use them where they replace something more fragile.
  • Slow, LOD-heavy dashboards often need a fix in the SQL layer, not a redesign of the visuals.
Pniel Analytics

Turn your data into decisions

We build Tableau and Power BI dashboards and the data models behind them. Book a free 30-minute analytics assessment and we'll map the fastest path for your team.

Book a Free Analytics Assessment

On this page

Why the number is wrong: grain

Grain is the level at which a number is calculated. One row per order line is one grain. One row per customer is another. One row per region is a third.

A plain calculated field follows the view. Tableau’s own example shows it. GDP per person for Luxembourg comes out at $108,972 at country level. Add Year to the view and the same field returns different values for 2011, 2012 and 2013. The formula did not change. The grain did.

That is correct behavior for many questions. It breaks when you need one number held at a fixed grain, or a comparison between two grains in the same view.

What LODs replace

Before LODs, teams worked around grain problems. The workarounds still show up in older workbooks:

  • Extra data sources or blends. A second source at customer grain, joined back to the first. Every blend adds a link that can break.
  • Duplicated SQL. The same customer-level query copied into several views, each with its own logic. The copies drift apart.
  • Table calculations. Functions such as TOTAL or WINDOW_AVG depend on the layout. Move a pill and the number changes.

Tableau’s documentation describes LOD expressions as a way to compute values at the data source level and the visualization level, with control over granularity. They are another tool next to calculated fields and table calculations, not a replacement for either.

The syntax

Every LOD sits in curly braces. The keyword comes first, then the dimensions, a colon and an aggregate.

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

Separate several dimensions with commas. You can leave the dimensions out, as in {FIXED : MIN([Order Date])}, to calculate across the whole data source. The aggregate part must be aggregated, and table calculations are not allowed inside it.

To build one, choose Analysis > Create Calculated Field and type the expression. When you write dimensions, drag the fields into the editor instead of typing them. Tableau recommends this because an expression that looks equivalent may not match the field on the shelf.

Case 1: First-purchase date for cohorts (FIXED)

Business question: In which month did each customer first buy, and how do those groups behave later?

// First Purchase Date
{ FIXED [Customer ID] : MIN([Order Date]) }

// Cohort Month
DATETRUNC('month', [First Purchase Date])

How to build it:

  1. Create the first calc. Tableau saves a FIXED expression without an aggregate on the outside as a dimension, so it can sit on Rows or Columns.
  2. Create Cohort Month from it.
  3. Put Cohort Month on Columns and Order Date by month on Rows.
  4. Put a count of distinct Customer ID on Text to see each cohort’s activity by month.

What it fixes: Without the LOD, you need a customer-level table joined back to the orders, or a table calculation that breaks when you add a dimension. Here the first date stays the same whatever else is in the view. Tableau’s documentation shows the same behavior: a FIXED minimum stays constant as more granularity is added to the view.

Pitfall: The result is the first purchase in your data, not necessarily the first purchase ever. If the extract starts in a given year, every older customer looks new in that year. Check the data’s start date before you label anyone a new customer.

Case 2: Percent of total sales by region (EXCLUDE)

Business question: What share of all sales does each region deliver?

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

How to build it:

  1. Put Region on Rows.
  2. Create the calc and drag it to Columns.
  3. Format the field as a percentage.

The EXCLUDE part removes Region from the view’s grain. It returns total sales for the whole view, repeated on each row. Each region’s sales divide by that total.

What it fixes: The usual answer is a table calculation, Percent of Total, set to compute along a direction. It works until someone adds a dimension or moves a pill. Salesforce’s help article on percent of total without table calculations uses this same EXCLUDE pattern. It notes that the outer SUM is needed to avoid the error about mixing aggregate and non-aggregate arguments.

Regional sales groups compared against a shared total

Pitfall: EXCLUDE only removes a dimension that is in the view. Name a dimension that is not there and nothing changes. Also, EXCLUDE respects dimension filters. Filter out the West region and the other regions will sum to 100%. That is often what you want. Know which behavior you are getting.

Case 3: Average sales per customer by segment (INCLUDE)

Business question: How much does a typical customer spend in each segment?

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

How to build it:

  1. Put Segment on Rows.
  2. Create the calc and drag it to Columns.

The INCLUDE adds Customer ID to the view’s grain. Tableau totals sales per customer, then averages those totals within each segment. Compare that with a plain AVG([Sales]). That gives the average order line, a different number that is easy to mistake for this one.

What it fixes: The common workaround is a customer-level data source or a separate SQL view, then a blend. The INCLUDE does it in one field.

Pitfall: Use an ID, not a name. Two customers who share a name merge into one under Customer Name, and the average shifts. Also remember that INCLUDE follows the view. Add Region to the view and the average is now per customer within each region and segment.

Case 4: Repeat versus one-time customer flag

Business question: How many customers bought more than once, and how much do they spend?

IF { FIXED [Customer ID] : COUNTD([Order ID]) } > 1
THEN "Repeat"
ELSE "One-time"
END

How to build it:

  1. Create the calc and name it Customer Type.
  2. Put Customer Type on Rows.
  3. Add a distinct count of Customer ID and SUM([Sales]) as columns.

The FIXED expression counts distinct orders per customer, no matter what is in the view. The IF turns the count into a label. Because the label is a dimension, you can use it as a filter, a color or a group.

What it fixes: Without it you build a customer table in SQL and join it back, or you write a table calculation that only works at one layout. Here the flag sits in the workbook and follows each customer.

Pitfall: The flag looks at the whole data set. Filter the view to one year and a customer who bought once that year but twice overall is still Repeat. If you need the flag within the filtered period, add the Order Date filter as a context filter. The next section explains why.

Case 5: Sub-category versus category average

Business question: Which sub-categories sell above or below the average for their category?

// Category Average
{ EXCLUDE [Sub-Category] :
  AVG({ FIXED [Category], [Sub-Category] : SUM([Sales]) }) }

// Difference From Category Average
SUM([Sales]) - [Category Average]

How to build it:

  1. Put Category and Sub-Category on Rows.
  2. Create Category Average, then the difference calc.
  3. Drag the difference to Columns and color by sign if you like.

The inner FIXED totals sales for each category and sub-category pair. The EXCLUDE then averages those totals across the sub-categories in each category. This follows the nested pattern in Tableau’s own documentation, which uses EXCLUDE around a FIXED expression to find a difference from an overall average.

Pitfall: The inner FIXED ignores dimension filters. Filter out two sub-categories and they still count in the average, so the benchmark no longer matches what the reader sees. Put the filter in context, or move the inner part to INCLUDE if a context filter is not suitable.

Context filters and order of operations

Most wrong LOD numbers come from filter order. Tableau runs calculations in a set sequence. Row-level and LOD calculations come first, then aggregations, then table calculations.

Filters follow their own order. FIXED expressions are computed before dimension filters, so those filters do not touch them. Context filters, data source filters and extract filters do. INCLUDE and EXCLUDE expressions are evaluated after dimension filters, so they respond to them.

Tableau’s documentation shows the effect with a ratio, SUM([Sales]) divided by a FIXED total. Filter by State and only the numerator changes. The denominator still holds sales for every state. The percentage looks plausible and is wrong.

You have two fixes:

  1. Right-click the filter and choose Add to Context. The filter now applies before the FIXED calc.
  2. Rewrite the calc as INCLUDE or EXCLUDE, so ordinary filters apply without context.

Use context filters sparingly. They are computed first and each one can add work for the data source.

FIXED vs INCLUDE vs EXCLUDE

FIXED INCLUDE EXCLUDE
Grain Only the dimensions you list View dimensions plus the ones you list View dimensions minus the ones you list
Depends on the view No Yes Yes
Dimension filters Ignored, unless context, data source or extract filters Applied Applied
Saved as Dimension or measure Always a measure Always a measure
Typical use Cohort dates, customer flags, fixed benchmarks Average of a finer level, such as per customer Percent of total, difference from an overall average
Common failure Filter appears to do nothing Result changes when the view changes Excluded field is not in the view

The save types and the filter behavior come from Tableau’s overview of LOD expressions and its filter documentation. The same overview explains replication. When the LOD is coarser than the view, its value repeats on each row. When it is finer, Tableau aggregates it up to the view. EXCLUDE always repeats values.

Errors you will meet

Cannot mix aggregate and non-aggregate arguments. This appears when part of a calculation is aggregated and part is not, such as [Sales] minus AVG([Sales]). Aggregate every part, or use a table-scoped LOD such as [Sales] - {AVG([Sales])}. Tableau lists this in its LOD overview.

A parameter name inside the dimension list. Use the parameter’s value, not its name, in a dimension declaration. The same page covers this.

A red LOD pill. On data models with multiple related tables, an INCLUDE cannot be evaluated across unrelated fields. A valid LOD in the Data pane can turn red in one sheet. Tableau’s multi-fact data model page lists the fixes: remove the unrelated field, change the view or remove the LOD.

Floating-point comparisons. Comparing decimal measures for equality can give unreliable results. Round first or compare with a tolerance.

When to use an LOD, and what it costs

LODs are not free. Be honest about both costs.

Performance. Each LOD can become its own subquery against the data source. A workbook with many of them, nested ones, or ones at fine grain such as customer or order line, runs slower. Tableau’s documentation also warns that some data sources have complexity limits, and a heavy calculation can cause query errors.

Debugging. An LOD hides its logic inside one field. When the number is off, you must check the grain, the filters in play, the context filters and the nesting. Name calcs by their grain, such as Sales per Customer (FIXED), and add a comment line inside the calc. Check each piece in a plain table with the dimensions visible.

A few habits keep LODs manageable:

  • Use FIXED when the value must not move with the view. Use INCLUDE or EXCLUDE when it should respond to filters.
  • Do not use FIXED to list every view dimension plus one. That is INCLUDE.
  • Test an LOD in a bare table before you put it in a chart.
  • Keep nesting to one level where you can.

When the slowness is in the data

Some slow dashboards are slow because of the data, not the calcs. The LOD is doing work the database should have done once. A customer-level total computed on every load is a common example.

For leaders, the signs are plain. A dashboard takes a long time to load. Two views disagree on the same metric. Someone adds a new calc each time a question comes up.

SQL-first teams move that logic upstream. A customer table with first purchase date and order count, built once in SQL, replaces two of the calcs above. The workbook then reads a field instead of computing one. Our executive dashboard guide shows how we think about trustworthy reporting for leadership.

How Pniel Analytics works on this

Pniel Analytics is a Tableau-first consulting firm. We also deliver in Power BI. Our approach is SQL-first. When a dashboard is slow or wrong, we fix it at the data layer before we redesign any visuals.

Engagements typically run 4 to 6 weeks. The same team builds and maintains the work. That means the person who wrote the calc is the person who can explain it later.

If you have a workbook full of LODs that no one trusts, see our Tableau consulting service. For the data work behind it, see data strategy and governance. You can also look at featured Tableau dashboards to see the kind of reporting we build.

Pniel Analytics

Author perspective

I would not start with LODs. I would start by asking what one row in the data represents. Most of the LOD problems I see come from a question asked at one grain and a table built at another.

My recommendation is simple. Learn the three keywords well enough to read them in a colleague’s workbook. Then use them for the narrow jobs they do best: cohort dates, customer flags and benchmarks. Everything else, be suspicious of.

When a workbook has more than a handful of nested LODs, treat it as a sign. The data model probably needs work. Move the repeated logic into SQL, give the workbook a clean customer table and an order table, and keep the LODs that are left. They will be shorter, faster and easier to explain to a finance lead who asks why a number changed.

Frederick Soh

If your totals still don’t match, our Tableau consulting team can audit the calculations and the data model behind them.

FAQ

What is the difference between a calculated field and an LOD expression?

A basic calculated field works at the row level or on an aggregate that follows the view. An LOD expression sets its own grain, so the result can differ from the view’s level. Tableau treats basic expressions, LOD expressions and table calculations as three separate types of calculation.

When should I use a FIXED LOD?

Use FIXED when the value must stay the same however the view changes. First-purchase date and repeat-customer flags are good examples. Remember it ignores ordinary dimension filters unless you add them to context.

Why does my FIXED calculation ignore my filter?

Tableau computes FIXED expressions before dimension filters, so those filters do not reach them. Right-click the filter and choose Add to Context, or rewrite the calc as INCLUDE or EXCLUDE.

Can I use a table calculation inside an LOD?

No. The aggregate part of an LOD must be an aggregation, and table calculations are not permitted inside it. An LOD can contain other LODs, which is how the nested example in Case 5 works.

Do LOD expressions slow a dashboard?

They can. Each one adds work for the data source, and nested or fine-grain ones add more. If a dashboard is slow and full of LODs, the fix is often in the SQL layer, where the logic runs once instead of on every load.

Sources

This article is for general informational purposes and reflects Pniel Analytics’ experience delivering BI and analytics work. It is not legal, financial, or compliance advice. For guidance specific to your data environment, contact us at fsoh@pnielanalytics.com.

Frederick SohFounder & Principal Consultant, Pniel Analytics

Frederick Soh leads Pniel Analytics’ Tableau, Power BI, and SQL dashboard engagements, turning scattered data into dashboards executives trust. He has 10 years of experience in business intelligence and analytics, is a Tableau Featured Author (2024), a Tableau Certified Data Analyst, and a Power BI Data Analyst Associate (PL-300).

Book a free 30-minute assessment
Pniel Analytics logo

About Pniel Analytics

Pniel Analytics is a Delaware-based business intelligence consultancy that builds trusted Tableau and Power BI dashboards for executive teams. We turn fragmented data into one clear, real-time view your team will actually use. Explore our services.

Pniel Analytics

Have a dashboard nobody opens?

Bring the report and tell us the decision it was meant to support. We’ll tell you honestly whether to rebuild it, adjust it, or retire it, in a free 30-minute assessment.

Book a Free Assessment

We use cookies for analytics to improve your experience. We only track you if you accept. See our Privacy Policy.