Navigation Guide

Key words:

LOD, level of detail, dimension, Granularity, Aggregated, FIXED LOD, INCLUDE LOD, EXCLUDE LOD

What is LOD?

In Tableau, LOD stands for Level of Detail. For simplicity, we will use LOD for short in the rest of the blog. LOD expressions are used to control the granularity of aggregations in your visualizations. They allow you to compute values at different levels of detail than the one currently in your view.

They look something like this down below, where it starts with the name of the LOD, i.e. FIXED, then specify the dimension(s) you would like the data to be aggregated on. Such as [Business ID], now we are fixing the calculation based on this level of detail, independent from any other level of detail specified on the Tableau viz board. After that, we need to tell Tableau which aggregation calculation you would like to apply. Such as SUM(). And we end with two curly brackets on both sides of this query, so Tableau knows it is a LOD.

So, this is returning the sum of user fans per business ID / on the Business ID level, regardless of what dimension you have on your Viz board.

“Easy” right? If you are not quite convinced or feel a bit puzzled just keep reading, later we will have a hands-on walkthrough of how to build a LOD from scratch.

 

Granularity

To fully understand how LOD works, you need to understand what granularity is. In Tableau, granularity refers to the level of detail or the degree of specificity in your data. It is essentially the level at which you are analyzing and visualizing your data. It can be controlled by selecting the appropriate dimension in the Rows or Columns shelf. A lower level of granularity, such as year or quarter, provides an aggregated view, while a higher level of detail, such as day or even hour, provides a more specific view. In essence, granularity is describing how detailed your data is.

Understanding granularity is crucial in Tableau because it affects how you aggregate and display your data in visualizations.

Note:

More granular = low level of detail = less aggregated

 

Tableau order of operations

There are three types of LOD expressions in Tableau:

  1. Fixed LOD (FIXED): Allows you to aggregate data at a specific level of granularity, regardless of the visualization’s dimensions.

Example:

{ FIXED [Category] : SUM([Sales]) }

This expression calculates the total sales for each category, regardless of other dimensions in the view.

  1. Include LOD (INCLUDE): Lets you aggregate data at a lower level of detail than the visualization’s dimensions while still considering those dimensions.

Example:

{ INCLUDE [Region] : AVG([Profit]) }

This expression computes the average profit for each region, considering other dimensions present in the view.

A graphical representation of how Tableau performs an INCLUDE LOD Expression is depicted in the following flow diagram.

  1. Exclude LOD (EXCLUDE): Aggregates data at a higher level of detail than the visualization’s dimensions, excluding specific dimensions from the aggregation.

Example:

{ EXCLUDE [Sub-Category] : MAX([Discount]) }

This expression calculates the maximum discount for each sub-category using whatever dimensions are in use in the viz, excluding the sub-category dimension from the aggregation.

A key to the EXCLUDE keyword: Tableau first removes the excluded dimension from the Viz LOD and performs the calculation as if the dimension was not present at all. The result is then displayed visually. A graphical representation of how Tableau performs an EXCLUDE LOD Expression is depicted in the following flow diagram.

A key distinction between INCLUDE/EXCLUDE and FIXED is where each fall in the filtering hierarchy as shown below. FIXED LOD Expressions are computed before dimension filters and after context filters. This can enable many use cases.

When in doubt, check this flow diagram!

Outro

In this section, we are going to demonstrate how different types of LODs work in Tableau. We will

So far I hope you enjoyed the content, we’ve touched on the basics of LOD, what a LOD is, and how they work. In the next blog, we will demonstrate how to build LODs in Tableau through a step-by-step tutorial. Stay tuned!

 

References:

Top 15 LOD Expressions. (n.d.). Tableau. https://www.tableau.com/blog/LOD-expressions

 

Narula, R. (2023, February 13). Granularity & Nested LOD Expressions — 3. Medium. https://medium.com/@narula.rashmi888/granularity-nested-lod-expressions-3-d02140c28189#:~:text=In%20Tableau%2C%20granularity%20refers%20to

 

Tableau’s Order of Operations. (n.d.). Help.tableau.com. https://help.tableau.com/current/pro/desktop/en-us/order_of_operations.htm

 

Understanding Level of Detail (LOD) Expressions with Tableau. (n.d.). Www.tableau.com. Retrieved December 19, 2023, from https://www.tableau.com/learn/whitepapers/understanding-lod-expressions#form

John Lyu
Author: John Lyu

John is deeply passionate about data and firmly believes in its transformative power, especially in areas like Machine Learning, Data-Centric AI (DCAI), and Storytelling with data. He is extremely excited about opportunities to test his knowledge and expand his industry insights, such as Kaggle competitions and visualization contests. John thrives on collaboration, enjoying the experience of working alongside talented colleagues and learning from their expertise. In his free time, John enjoys playing basketball, hitting the gym, and hanging out with friends. He is also a trading card collector. He enjoys making new friends, so be sure to come and say hi.