In Tableau, an LOD (Level of Detail) function allows for a user to define the level at which a calculation should be performed, regardless of the visualisation’s aggregation level (what is being displayed in the view.) There are three types: Fixed, Include and Exclude. Using an example dataset, I will explore the differences in each type.

Let's take the example dataset below:

This shows us Sales data for the North region

FIXED

  • The FIXED LOD function calculates values at a specific dimension level without reference to the view level of detail.

Syntax:

JavaScript
{ FIXED [Dimension]: AGG([Measure]) }

Example: Calculating the sum of sales of the whole region

JavaScript
{ FIXED [Region] : SUM([Sales]) }

What this formula does is ignore the Store row, find the 'North' region and sum up all the sales. Therefore, you would end up with an output of 14,000 for both Store A and B.

  • Order of Operations: FIXED LODs are calculated BEFORE standard dimension filters.
    • If you use a normal filter to hide "Store B" from your chart, your FIXED calculation will still show 14,000. It completely ignores the filter. If you want your filter to apply to a FIXED LOD, you must right-click the filter in Tableau and select "Add to Context." Context filters are processed before FIXED calculations.

INCLUDE

  • The INCLUDE LOD function computes values using the specified dimensions in addition to whatever dimensions are in the view.

Syntax:

JavaScript
{ INCLUDE [Dimension]: AGG([Measure]) }

Example: Average sale for each store

JavaScript
{ INCLUDE [Manager] : AVG([Sales]) }

What this formula does is go past the Store row, find the individual managers inside each store, and average their sales together. You would therefore end up with an output of 4,000 for Store A and 3,000 for Store B.

  • Order of Operations: INCLUDE LODs are calculated AFTER standard dimension filters.
    • If you add a regular filter to remove the manager "Simon" from your data, the INCLUDE calculation will instantly adapt. It will look at Store A, see only Joe (5,000), and change your LOD result from 4,000 to 5,000.

EXCLUDE

  • The EXCLUDE LOD function does the exact opposite of INCLUDE. It subtracts detail, calculating at a higher level of granularity by explicitly ignoring specific dimensions in your chart.

Syntax:

JavaScript
{ EXCLUDE[Dimension]: AGG([Measure]) }

Example: Calculating sales and ignoring the store column

JavaScript
{ EXCLUDE[Store]: SUM([Sales]) }

As the function name suggests, this function ignores the individual stores, and you would only see the sum of sales for the entire region. It essentially skips the store level and goes to the next level of detail. Here, you would see an output of 14,000.

  • Order of Operations: EXCLUDE LODs are calculated AFTER standard dimension filters.
    • If you add a regular filter to remove "Store B" from your data, the EXCLUDE calculation will instantly adapt. It will look at the remaining data in the view (Store A), strip away the store boundary, and change your LOD result from 14,000 to 8,000.