top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

Level of detail expression easy way

Tableau LOD expres

sions are used to find answers to questions that involve multiple levels of granularity in a single visualization. With the help of LOD expressions, you can compute aggregations that are not at the detail level of visualization. LODS can be written the same way as calculations. After writing LOD expressions they will be seen in measures section with =# sign in front of it.


There are 3 types of LOD expressions.

  1. Fixed

  2. Include

  3. Exclude

1-FIXED LOD- FIXED level of detail expressions compute a value using the specified dimensions, without reference to the dimensions in the view. It is very stubborn kind LOD, it will not get affected by other dimension.



Using fixed lOD above we plot this visualization. It is showing sales per region only because we told it to fix Region . No matter what you add in rows like state here , it will just stick to sales per region only. It will ignore state completely. But if we want to see sales region wise and state wise both we have to change the LOD type to Include.


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

In short it will respect other dimensions mentioned in row as well. It will not ignore state in row as fixed did.

to write Include LOD expression we just need to change Exclude word with Include




Now we are plotting the same table as above with include LOD instead of fixed.one can see how it make sense


INCLUDE level of detail expressions can be useful when you want to calculate at a fine level of detail in the database and then re-aggregate and show at a coarser level of detail in your view. Fields based on INCLUDE level of detail expressions will change as you add or remove dimensions from the view.


If we select sales per customer , it will show details on customer level. Double click sales per customer and then change to average from measure value shelf on left side below marks shelf. right click on sum(sales per customer) measure then average.



3. EXCLUDE LOD expression

Syntax for exclude is same as include and fixed. EXCLUDE level of detail expressions declare dimensions to omit from the view level of detail. EXCLUDE level of detail expressions are useful for ‘percent of total’ or ‘difference from overall average’ scenarios. They are comparable to such features as Totals and Reference Lines.


We are creating the same table as previous using sales by region (exclude)

exclude LOD instead include. If we observe it is giving same output as include .


In this example we will see month sale region wise. Level of detail expression excludes [Region] from a calculation of the sum of [sale by region(exclude) ] using same expression.


Following view is break out of the sum of sale by region and by month:

here we added sales by region(exclude) LOD in color. Dropping sales by region(exclude) on Color shades the view to show total sales by month but without the regional component:


EXCLUDE expressions always cause replicated values to appear in the view. When calculations, including EXCLUDE level of detail expressions, are placed on a shelf, Tableau defaults to the ATTR aggregation as opposed to SUM or AVG, to indicate that the expression is not being aggregated and that changing the aggregation will have no effect on the view.

Putting all together

  • 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.


Try these things

  1. sale region wise


2.Average sale per customer Region wise



3..Average sale by ship mode

The formula is { FIXED [Ship Mode]: SUM([Sales]) }

4. Average sales per customer


5. Average sale state wise in all 4 region


I hope this will give you basic understanding of LOD expressions.

Thank you

12 views0 comments

Recent Posts

See All
bottom of page