English 中文(简体)
Tableau Tutorial

Tableau Data Sources

Tableau Worksheets

Tableau Calculations

Tableau Sort & Filters

Tableau Charts

Tableau Advanced

Tableau Useful Resources

Selected Reading

Tableau - LOD Expressions
  • 时间:2024-11-05

Tableau - LOD Expressions


Previous Page Next Page  

Level of Detail (LOD) expressions are used to run complex queries involving many dimensions at the data source level instead of bringing all the data to Tableau interface. A simple example is adding dimension to an already calculated aggregate value.

Types of LOD

There are three main types of LOD expressions.

    FIXED LOD This expression computes values using the specified dimensions without reference to any other dimensions in the view.

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

    EXCLUDE LOD These levels of detail expressions subtract dimensions from the view level of detail.

FIXED Level of Detail Expressions

Find the amount of Sales for each state in each region. Here, first create the formula field named Regional Sales using the formula as shown in the following screenshot.

fixed lod 1

Next, drag the Region and State field to the Rows shelf and the calculated field to the Text shelf under the Marks card. Also drag the Region field to the Color shelf. This produces the following view, which shows a fixed value for different states. That is because we have fixed the dimension as region for the calculation of Sales value.

fixed lod 2

INCLUDE Level of Detail Expressions

INCLUDE level of detail expressions compute values using the specified dimensions in addition to whatever dimensions are in the view. Calculate the sum of sales per state for each sub-category of products.

For this, drag the Sub-Category field to the Rows shelf. Then, write the expression in the Columns shelf as shown in the following screenshot. It produces the following view which includes both the dimensions in the calculations.

include lod 1

EXCLUDE Level of Detail Expressions

EXCLUDE level of detail expressions specify dimensions to exclude from the view level of detail. Exclude Region from Sales figure calculated for every month. Create the formula as shown in the following screenshot.

exclude lod 1

On dragging the relevant fields to the respective shelves, you will get the final view for the EXCLUDE LOD as shown in the following screenshot.

exclude lod 2 Advertisements