Skip to main content

Command Palette

Search for a command to run...

Level of Detail (LOD) Tableau

Published
3 min read
W

Hello,

I'm passionate about transforming raw data into actionable insights, driven by a lifelong fascination with numbers. As a data analyst, I enjoy uncovering meaningful patterns and collaborating with like-minded individuals.

I'm also a strong advocate for mental health and use data to contribute to this important cause. My background in the medical field enhances my analytical approach, bridging the gap between healthcare and data analysis.

When working with data in Tableau, one of the most common challenges is deciding at what level calculations should be performed. Should we aggregate across the entire dataset, or should we calculate values per category, country, or even at the transaction level?

That’s where Level of Detail (LOD) Expressions come in. They allow you to explicitly control the granularity of your calculations, giving you flexibility far beyond the default aggregations.

What Are LOD Expressions?

LOD expressions let you aggregate data at a dimension level you specify, regardless of the level of detail in your view.

For example:

  • A measure with no dimensions (e.g., SUM([Sales])) will aggregate at the highest level, total sales and has the least level of detail.

  • A measure with dimensions (e.g., Category, Country, Month) will calculate at the most detailed level available in the visualization.

But with LOD expressions, you can fix, include, or exclude dimensions to get exactly the level of aggregation you need.

Types of LOD Expressions

1. FIXED

  • Syntax: {FIXED [dimension] : <aggregation>}

    NB: dimension is optional and can include as many columns as one wants to have.

  • Behavior: Independent of the view, ignores the current dimensions.

  • Use Case: When you want a calculation at a specific level, regardless of what’s shown.

  • Example:

      {FIXED [Customer ID] : SUM([Sales])}
    

    Sales per customer, even if Customer ID is not in the view.

2. INCLUDE

  • Syntax: {INCLUDE <dimension> : <aggregation>}

  • Behavior: Adds detail to the current view.

  • Use Case: When you want more granularity than the view provides.

  • Example:

      {INCLUDE [Product ID] : AVG([Discount])}
    
    • Step 1 (Bring in product-level detail)
      Tableau first calculates the average discount per product (even though product is not in the view).

    • Step 2 (Roll it up to the view’s level)
      Since our view only has Category, Tableau then averages those per-product discounts up to the Category level.

      Instead of seeing the total discount per category (368.9 for Furniture), you'd see the average discount per product within that category. This helps understand if discounts are distributed evenly or if a few products are getting most of the discount amounts.

      Simple analogy:

      • Without INCLUDE: Total discount for all Furniture products: $368.90

      • With INCLUDE: Average discount per Furniture product: $65.7

    • Another example:

3. EXCLUDE

  • Syntax: {EXCLUDE <dimension> : <aggregation>}

  • Behavior: Removes a dimension from the view.

  • Use Case: When you want higher-level aggregation while a finer detail exists in the view.

  • Example:

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

    - Ignores Region, even if Region is displayed in the view.

  • A practical example could be if we want to see how each region contributed to sales, we do not want the denominator to change.

Tableau’s Order of Operations (Where LODs Fit)

To understand how Tableau computes results, it helps to know the order of operations:

  1. Extract filters

  2. Data source filters

  3. Context filters

  4. Sets, Conditional filters, Top N filters, FIXED LOD

  5. Dimension filters

  6. INCLUDE/EXCLUDE LOD, Data blending

  7. Measure filters

  8. Table calculations

Key takeaway:

  • FIXED happens before dimension filters.

  • INCLUDE/EXCLUDE happen after dimension filters

Other Resources