- Bernard

# Introduction to Tableau Level of Detail Expressions

Updated: Sep 4, 2020

Level of detail expressions (also known as LOD expressions) allow you to compute values at the data source level and the visualization level, giving you more control on the level of granularity you want to compute.

**Types of LOD Expressions**

There are three types of LOD expressions in Tableau.

**FIXED LOD**– This expression computes values on a specific dimension without reference to any other dimension in the view.**INCLUDE LOD**– This expression computes values using dimension specified in the expression in addition to dimensions present in the view.**EXCLUDE LOD**– This expression omits dimensions from the view level of detail.

**LOD Expressions Syntax**

The level of detail expression has the following structure.

**{FIXED|INCLUDE|EXCLUDE <dimension declaration> : <aggregated expression>}**

**Dataset**

In this guide we use the **Superstores** data set pre-packaged with Tableau app to explore the Tableau LOD expressions.

You can download the data **here** to follow along.

**FIXED Level of Detail Expressions**

The FIXED Level of detail expression is used to compute values on a specific dimension without reference to the dimension in the view.

In this example, the FIXED level of detail expressions computes the sum profit per product category.

When this expression ’Profit per category’ is placed under text shelf for a view with dimension ‘Category’ and ‘Sub-Category’, the expression returns identical values for each region.

This is because, being a FIXED level of detail expressions, the calculation doesn’t consider the view level of detail, but only uses the dimension referenced in the calculation, in this case ‘Category’.

Therefore, this calculation returns the profit for each Category irrespective of dimension ‘Sub-Category’ being in the view – hence the reason for identical values.

**Related:** **Using FIXED level of detail expression to compute proportion of total.**

**INCLUDE Level of Detail Expressions**

The INCLUDE level of detail expressions computes values using the dimension specified in the expression in addition to dimensions present in the view.

INCLUDE level of detail expressions is useful when you need to compute at a fine level of detail in the data source and then re-aggregate at a course level of detail in your view.

In this example, the INCLUDE level of detail expression computes the total profit per customer.

When this calculation ‘Sales per customer’ is dragged to the Text shelf -aggregated by AVG, and dimension ‘Region’ to the rows shelf. The resulting view will be showing average customer sales per region.

This is because, the INCLUDE level of detail expression includes the dimension ‘Customer Id’ which is not in the view level without dragging it to the rows, columns or detail shelfs.

**EXCLUDE Level of Detail expressions**

The EXCLUDE level of detail expressions is used to omit dimensions from the view level of detail.

In this example, the level of detail expression is used to exclude ‘Sub-Category’ from the calculation of sum of profit.

When this calculation is placed on the text shelf and dimension field ‘Category’ and ‘Sub-Category’ on the rows shelf results to a similar view to the case FIXED level of detail expressions.

This is because the level of detail expressions omits the dimension Sub-Category in the calculation leaving only dimension Category as the level of detail – similar to fixing dimension Category.

**Examples of Tableau Level of Detail Expressions**

Learning Tableau LOD expressions can be challenging without proper examples to guide you through. This article on **Top 15 LOD expressions** by Tableau will guide you through some of examples where Tableau LOD expressions is applicable.

I hope this article was helpful to you.

To receive more of these Tableau guides in your inbox, kindly subscribe to the emailing list.

Thank you for reading.