Tableau LOD Expressions

LOD (level of Details) expression is used to run complex queries involving many dimensions at the data sources instead of bringing all the data to the Tableau interface.

Types of LOD expression

There are three types of LOD expressions in the Tableau:

  • FIXED LOD: This LOD expression computes the values using the specified dimensions without reference to any other dimensions in the view.
  • INCLUDE LOD: This LOD expression computes the values using the specified dimensions with any other dimensions in the view.
  • EXCLUDE LOD: These LOD expressions subtract dimensions from the view level of detail.

FIXED Level of Detail Expressions

For example, if you want to calculate the number of Sales for each state in each region. Then,

First, create the formula field named regional_sales using the formula as shown in the below screenshot.

Tableau LOD Expressions
  • Then, drag the Region and State field to the Rows shelf and the calculated field (regional_sales) to the Text shelf under the Marks card.
  • Also, drag the Region field to the Color shelf.
  • This creates the below view, that shows a fixed value for different states because we fixed the dimension as a region for the calculation of Sales value.
Tableau LOD Expressions

INCLUDE Level of Detail Expressions

INCLUDE level of detail expressions compute values using the specified dimensions whatever dimensions are in the view.

For example, if you want to calculate the sum of sales per state for each sub-category of products. Then,

  • Drag the Sub-Category field to the Rows shelf.
  • And, write the expression " {INCLUDE [State] : SUM(Sales)} " in the Columns shelf.
  • It creates the view that includes both the dimensions in the calculations as shown in the below screenshot.
Tableau LOD Expressions

EXCLUDE Level of Detail Expressions

EXCLUDE level of detail expressions describe the dimensions to exclude from the view level of detail.

For example, Exclude Region from the Sales figure calculated for every month. First,

  • Create the formula " {EXCLUDE [Region] : SUM([Sales])} " as shown in the below screenshot.
Tableau LOD Expressions
  • On dragging the relevant fields to the respective shelves, you get the final view for the EXCLUDE level of detail expressions as shown in the below screenshot.
Tableau LOD Expressions




Latest Courses