top of page

Simple calculations with {LOD} in Tableau

Writer's picture: Anandhi SundarAnandhi Sundar

Level of Detail
Image from Google : Level of Detail



First we see what is LOD ?


Level of Detail (LOD) expressions is used to check the granularity of data and allows you to compute the values at the data level or visualization level, it can be at a more granular level or less granular level of detail.


syntax:


{<LOD type><dimension>:<calculation>}





There are three main types of LOD expressions.


FIXED LOD


It produces a fixed value for a specified dimensions, it focuses more on calculations.


INCLUDE LOD


It is used to include a specified dimension along with other dimension within the view.


EXCLUDE LOD


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


Now we see one by one with examples


Fixed Level of Detail Expressions


For example I want to calculate the number of sales for each State in each Region, then create a formula field named as Fixed using the formula as shown in the below screenshot.


Image by Author

Then, drag the [Region] and [State] field to the Rows shelf and the calculated field [Fixed] 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.


Image by Author

Now I drag Sum [Sales] and Calculated field [Fixed] in columns, you will see the Bar chart created as below:



Image by Author

Include Level of Detail Expressions


It compute values using the specified dimensions whatever dimensions are in the view.


Drag [Region] into column shelf and [SUM(Sales)] in rows shelf. Now you will see the Bar chart of Regional Sales.

Image by Author

Create a new Calculated field as shown below:



Image by Author

Drag this LOD calculation [State wise Sales] into the rows shelf and change the aggregation to Average (AVG) by right-clicking on both [SUM(Sales)] and [State wise Sales].


Image by Author

You can see the average of sales is calculated at State level of details by clicking label icon below help. If you see in the below image the first Bar graph is showing overall Average Sales while another Bar graph is showing Average Sales of States.



Image by Author

Exclude Level of Detail Expression


As the name ‘EXCLUDE’ itself says that it excludes the dimension from the view that means it subtracts the dimension from the view level of detail.


Drag [Region] and [Sum (Sales)] into the column shelf and [Month (Order Date)] into the rows shelf.


Image by Author

Create the new calculated field Exclude as shown below:

Image by Author

Now drag this field into the color shelf and see that your view is colored based on Month but not by Region which I have added in my LOD calculation.




Image by Author

Hence, EXCLUDE level of detail expressions are most useful for eliminating the dimension in the view.


I think you might have gotten a better idea about What is LOD? or How to use LOD? or when to use it?


I hope you have started loving LODs as they allow you to do some tricky things in Tableau.







171 views

Recent Posts

See All

+1 (302) 200-8320

NumPy_Ninja_Logo (1).png

Numpy Ninja Inc. 8 The Grn Ste A Dover, DE 19901

© Copyright 2025 by Numpy Ninja Inc.

  • Twitter
  • LinkedIn
bottom of page