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.
There are three main types of LOD expressions.
It produces a fixed value for a specified dimensions, it focuses more on calculations.
It is used to include a specified dimension along with other dimension within the view.
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.
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.
Now I drag Sum [Sales] and Calculated field [Fixed] in columns, you will see the Bar chart created as below:
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.
Create a new Calculated field as shown below:
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].
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.
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.
Create the new calculated field Exclude as shown below:
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.
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.