LOD Expressions In Tableau: The All In One Guide

The right Business Intelligence Tool is the key to success in the current market. Tableau is one such powerful data visualization tool. Tableau aims to eliminate complications and present data in the most informative way, through charts and graphs.

No matter what level of complexity you have with your data, Tableau can crack it with its best-in-class functionalities. Tableau can transform your calculations into visualizations. This is exactly where we come across the Level-Of-Detail or LOD Expressions in Tableau.

What Are LOD Expressions in Tableau?

To understand the LOD Expressions in Tableau, you need to understand the problems faced while computing aggregations on data on different levels of details. It is often much more complex to find answers to the questions, as the level of granularity (minute details) in the data increases gradually. 

Become a Data Scientist with Hands-on Training!

Data Scientist Master’s ProgramExplore Program
Become a Data Scientist with Hands-on Training!

For Example:

Picture this, you own an OTT service providing similar functionalities to Netflix. And using Tableau, you can find general insights explaining like:

  • Genres
  • Top-Watched movie
  • Least-Watched Movie
  • Highest Ratings
  • Least Rating and many more

But what if you wanted to find some information with minute details?

Like, the specific days in a month or a week where you received the maximum number of views for a particular movie.

The LOD Expressions in Tableau help to resolve the same. The LOD Expressions were introduced to Tableau from its ninth release, the Tableau 9.0. The LOD expressions in Tableau make you capable of performing aggregations that are unavailable at a certain level of visualization.

The LOD Expression is highly precise and can be implemented in the most discrete and irrational ways.

Advancing, you will understand the Syntax of LOD Expressions in Tableau.

Syntax of LOD Expressions in Tableau

The general syntax for the LOD Expressions in Tableau follows the Syntax as shown below.

The syntax for INCLUDE LOD Expressions in Tableau:

{[ INCLUDE ] < declaration of the dimension > : <expression to aggregate>}

The syntax for EXCLUDE LOD Expressions in Tableau:

{[ EXCLUDE ] < declaration of the dimension > : <expression to aggregate>}

The syntax for FIXED LOD Expressions in Tableau:

{[ FIXED ] < declaration of the dimension > : <expression to aggregate>}

To understand the LOD Expressions in Tableau in a much better and interactive way, it’s time to dive into the next segment. You will practically understand the various types of LOD expressions and execute them practically.

Types of LOD Expressions in Tableau

There are three different types of LOD Expressions in Tableau. They are:

  1. INCLUDE
  2. EXCLUDE
  3. FIXED

You will learn about each one of them in detail with practical examples. You will use the superstore dataset and try to extract some insights from the data available.

INCLUDE LOD Expressions

It implements the INCLUDE Level of Detail Expression when there is a need to calculate finer levels of detail in the database and then later re-aggregate it and present it at a coarser level. As the dimensions are added or removed from the view, the fields based on the INCLUDE LOD expressions will vary.

How to create INCLUDE LOD Expressions?

  • Please create a new sheet and rename it "INCLUDE Sheet" for reference
  • To implement the LOD Expressions, you need to create a visualization
  • Drag region to columns, and sales to rows
  • Tableau will autogenerate a bar chart as shown below

INCLUDE-LOD-Expression-image

  • Now the next step is to create a calculated field
  • Select the analysis option, choose the "Create Calculated Field" option

LOD-Expressions-in-Tableau-INCLUDE-LOD-Expression-image-2.

  • Now our next step is to add the formula to the calculated field

{INCLUDE [Customer Name] : SUM([Sales])}

LOD-Expressions-in-Tableau-INCLUDE-LOD-Expression-image-3.

  • Now drag the newly created calculated field from the measures panel to rows 
  • Tableau will automatically create two bar charts, as shown below

INCLUDE-LOD-Expression-image-4

  • Now, the last step is to change the aggregation to average
  • To do so, right-click on the "sales per customer" pill
  • Select the "Measure" option
  • Click on the average option in the drop-down

INCLUDE-LOD-Expression-image-5

  • The resultant visualization will be as shown below.

Expressions%20in%20Tableau/LOD-Expressions-in-Tableau-INCLUDE-LOD-Expression-image-6

With that, you will now head to the next type of LOD Expressions in Tableau, which is the EXCLUDE LOD Expressions in Tableau.

EXCLUDE LOD Expressions

EXCLUDE Level of Detail Expressions can help eliminate the dimensions from lower granularity levels and concentrate on calculating the dimensions from the higher level of granularity.

Become a Data Scientist with Hands-on Training!

Data Scientist Master’s ProgramExplore Program
Become a Data Scientist with Hands-on Training!

How to create EXCLUDE LOD Expressions?

The below-mentioned steps are followed to generate the EXCLUDE LOD Expressions.

  • Please create a new sheet and rename it as "EXCLUDE sheet" for reference
  • Create a new calculated field
  • Go to Analysis
  • Select the option of "Create Calculated Field"

EXCLUDE-LOD-Expression-image-1

  • Rename the Calculated field as EXCLUDE Calculation
  • Write the following formula in the calculation field

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

EXCLUDE-LOD-Expression-image-2.

  • Now you must drag the region and sales to the rows
  • And order date to columns (aggregate the date to month-wise)

  • Tableau will automatically create a line graph
  • To present it in a readable way, change it to the bar graph
  • Go to the marks card and change the option from automatic to bar chart

EXCLUDE-LOD-Expression

  • The updated visualization looks like this

EXCLUDE-LOD-Expression-image

  • Now drag the EXCLUDE calculation to colors on the marks card

LOD-Expressions-in-Tableau-EXCLUDE-LOD-Expression-image-6

  • The previous step will help you improve the readability of the visualization
  • The final visualization is as follows

EXCLUDE-LOD-Expression-image-7

Next, you will understand how to create the FIXED LOD Expressions in Tableau. 

Become a Data Scientist with Hands-on Training!

Data Scientist Master’s ProgramExplore Program
Become a Data Scientist with Hands-on Training!

FIXED LOD Expressions

FIXED Level of Detail Expression is designed to apply calculations only on the specific dimensions. It does not reference the remaining dimensions in view while the FIXED LOD expressions are implemented.

How to Create FIXED LOD Expressions?

The following procedures will help us create the FIXED LOD Expressions in Tableau.

  • Please create a new sheet and rename it as "FIXED Sheet" for reference
  • Go to the Analysis option and create a new calculated field

FIXED-LOD-Expression-image-1.

  • Rename the calculated field as "Sales by Region"
  • Write down the following formula in the calculated field section

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

Tableau-FIXED-LOD-Expression-image-2

  • Now drag Region and States to the columns. 
  • Let us drag the "Sales by Region" calculation field to rows
  • The resultant visualization will look something like this below

Tableau-FIXED-LOD-Expression-image

With this, you will move to the next part, where you will learn the fundamental differences between the Table and LOD Expressions in Tableau.

Table v/s LOD Expressions in Tableau

The table below explains the major differences between a Table and LOD Expressions.

Table

LOD Expressions

Filters behave as "HIDE" operations when implemented in Table

Filters behave as "EXCLUDE" operation when implemented in LOD Expressions

It generates table Calculations as overall query outputs

It creates LOD Expressions as a part of the overall query to the data source beneath

Table calculations generate either comparable or less granular results than promised

LOD Expressions can generate results independent of said granularity

It implements table calculations as aggregated measures

It can utilize LOD Expressions in other constructs

Dimensions that control the operations of a table are separate from the calculation syntax.

It embedded dimensions that control the operations of a LOD in the expression itself.

In the next section, you will look into the limitations of LOD Expressions in Tableau.

Limitations of LOD Expressions in Tableau

Following are the major limitations that are needed to be considered while using the LOD Expressions in Tableau.

  • LOD Expressions behave unreliable views when floating values are involved
  • LOD Expressions will not be shown in the Data Source
  • When referencing a dimensionality declaration parameter, always use the parameter name and not the parameter value
  • With data blending, the primary data source's linking field must be in the view before you can use a LOD expression from the secondary data source.

With that, you have reached the end of this "Lod Expressions in Tableau - the All in One Guide" article.

Become a Data Scientist with Hands-on Training!

Data Scientist Master’s ProgramExplore Program
Become a Data Scientist with Hands-on Training!

Next Steps

Data Blending in Tableau can be your next stop. Data Blending in Tableau will help you combine relative data sources and extract insights with ease.

Want to enhance your skills and gain in-depth knowledge about Tableau Software to become certified as a Business Intelligence Professional? Feel free to explore Simplilearn's Caltech Data Science Bootcamp. The program is designed by top subject matter experts and delivered by leading practitioners in the field to help you move forward in your career. 

If you have any queries concerning this article, please feel free to leave them in the comments section at the end of this article, and our team of experts will answer them for you at the earliest!

About the Author

Ravikiran A SRavikiran A S

Ravikiran A S works with Simplilearn as a Research Analyst. He an enthusiastic geek always in the hunt to learn the latest technologies. He is proficient with Java Programming Language, Big Data, and powerful Big Data Frameworks like Apache Hadoop and Apache Spark.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.