Tutorial

Tableau LOD Expressions Guide: FIXED, INCLUDE & EXCLUDE

Master Tableau Level of Detail (LOD) expressions. Learn syntax and examples for FIXED, INCLUDE, and EXCLUDE to calculate Percent of Total without filter errors.

Anuj SainiAug 23, 202610 min read

If you have ever tried SUM([Sales]) / SUM([Sales]) and got 100% on every row, you hit the grain problem. Tableau LOD lets you declare the denominator's grain explicitly — from Total to Category — without moving pills. Built from scripts 08–09 on Superstore, this is the conceptual moat between basic and analyst-level Tableau.

For calculation basics see Tableau Calculated Fields and for table-scoped logic see Tableau Table Calculations. For modelling see Tableau Relationships vs Joins.


What is an LOD Expression?

Grain control in curly braces Tableau Help: LOD Overview. Think camera lens: the visualisation is the current zoom, LOD lets you compute at a different zoom.

tableau
{ [Type] [Dimension] : AGG([Measure]) }
 
// Examples
{ FIXED [Category] : SUM([Sales]) }
{ INCLUDE [Product Name] : AVG([Sales]) }
{ EXCLUDE [Region] : SUM([Sales]) }

Every LOD is wrapped in {}. Inside: the keyword, optional dimension list, colon, then aggregation. The result is aggregated and can be used anywhere a measure is used.

How does FIXED work and when to use it?

Locks to declared dimensions, independent of view Tableau Help: FIXED.

tableau
// Category sales regardless of view
{ FIXED [Category] : SUM([Sales]) }
 
// Category + Region grain
{ FIXED [Category], [Region] : SUM([Sales]) }
 
// First order date per customer for cohort
{ FIXED [Customer Name] : MIN([Order Date]) }

Key property: FIXED evaluates before most Dimension Filters in Tableau Order of Operations — between Context Filters and Dimension Filters. Use it when:

  • You show Sub-Category but need Category totals per row.
  • You compute Percent of Total where denominator must stay full total despite Sub-Category filters.

If your view shows Sub-Category and you filter out 'Chairs', {FIXED [Category] : SUM([Sales])} still returns Furniture's full total — allowing correct percent.

Gotcha: LOD vs Table Calc Confusion

New analysts use a Table Calculation for Category Total and watch it change when they filter Sub-Categories — because table calcs compute on the view's marks. LOD FIXED computes before those filters, so it holds. If your total drifts on filter, you likely need FIXED, not a table calc. This distinction is a classic ₹5–10 LPA interview probe.

When should you use INCLUDE vs EXCLUDE?

Both respect view filters and viz LOD Tableau Help: INCLUDE/EXCLUDE — opposite of FIXED.

  • INCLUDE: adds a dimension missing from the view.
tableau
// Average per Product when view shows only Category
{ INCLUDE [Product Name] : AVG([Sales]) }

Tableau computes AVG at Product Name grain then aggregates to the Category view. Without INCLUDE, AVG would be at Category grain — a different number.

  • EXCLUDE: removes a dimension present in the view.
tableau
// Category total despite Region being on Rows
{ EXCLUDE [Region] : SUM([Sales]) }

View shows Category × Region, but EXCLUDE yields one Category total repeated across regions — revealing broader trend vs regional split.

Feature / Criteria

How do you build Percent of Total?

Ratio of two aggregated grains Tableau Help: LOD. The error Cannot mix aggregate and non-aggregate appears when one side is row-level and the other is LOD-aggregated. Fix by aggregating both:

tableau
// Overall percent
SUM([Sales]) / SUM({ FIXED : SUM([Sales]) })
 
// Category-level percent
SUM([Sales]) / SUM({ FIXED [Category] : SUM([Sales]) })
 
// Format as percentage in Format pane

Nesting LODs solves complex cases: SUM({INCLUDE [Product Name] : SUM([Sales])}) / SUM({FIXED : SUM([Sales])}) — numerator at product grain, denominator at total.

Always test with filtered vs unfiltered view: FIXED denominators should hold steady.

Pitfalls and quick reference

TaskLODNote
Total despite filters{FIXED : SUM([Sales])}Blank after colon = overall
Cohort first date{FIXED [Customer Name] : MIN([Order Date])}Use for retention without ETL
Avg per product inside category{INCLUDE [Product Name] : AVG([Sales])}View shows Category only
Remove region grain{EXCLUDE [Region] : SUM([Sales])}View has Category × Region

Check Tableau Help: LOD for source compatibility (some OLAP cubes restrict LOD). Explore our Complete Tableau Guide and Tableau Tips for Analyst Workflows, or apply LODs to time analysis in Tableau Table Calculations and interactivity via Tableau Parameters.

Master Advanced Tableau Calculations

Practice FIXED, INCLUDE, and EXCLUDE LOD expressions on Superstore data with automated scenario testing.

Learn Tableau Free

Frequently Asked Questions

What is a Tableau LOD Expression?

An LOD Expression lets you aggregate at a grain different from the view's viz LOD, using curly-brace syntax {FIXED / INCLUDE / EXCLUDE [Dim] : AGG([Measure])} without changing rows or columns.

What does FIXED LOD do that INCLUDE and EXCLUDE do not?

FIXED computes at the declared dimensions regardless of the view and bypasses standard dimension filters, landing between Context and Dimension filters in the Order of Operations. INCLUDE and EXCLUDE respect view filters and viz LOD.

How do you write Percent of Total with LOD?

Use SUM([Sales]) / SUM({FIXED : SUM([Sales])}) for overall percent, or SUM([Sales]) / SUM({FIXED [Category] : SUM([Sales])}) for category-level percent. Both sides must be aggregated to avoid mixing errors.

When should you use INCLUDE vs EXCLUDE?

Use INCLUDE to add a dimension not in the view (e.g., average per product while view shows category). Use EXCLUDE to remove a dimension present in the view (e.g., category totals despite region in rows).

Why does my LOD still get filtered?

If the filter is a Dimension Filter, FIXED will ignore it but INCLUDE/EXCLUDE will not. Promote the filter to Context to make FIXED respect it, or keep it as Context if you need FIXED to include filtered values.

Anuj Saini

Written by

Anuj SainiFounder & Lead Instructor

Founder at Topfolio with 6+ years in data & analytics across JPMC, Ultrahuman, and high-growth startups. Sat on hiring panels, reviewed 500+ resumes, and writes practical SQL & data guides.