## Tableau - LOD Basics

LOD stands for level of detail. LOD expressions as the name suggests, lets the user control the level of detail the measure is aggregrated to. Without LOD expression, a measure is aggregrated to the level of detail of the visualization. (I.e the current filter context determined by the dimensions in the row, column and filter shelves. In other words with LOD expressions, you can override the filter context and choose the level of detail for your measures.

### Creating your first LOD Expression

Create a new calculated field in Tableau called "Sales By Customer" and type


{FIXED [Customer Name] : SUM([Sales])}


This ensures that regardless of the fields in the visual, sales is always aggregated at the customer level.

Try It: Using Tableau's sample superstore data, add the following to the rows shelf:

• Customer Name
• Order Id
• Sales By Customer
• Sales

You should see sales being aggregrated on the Customer Name Level for "Sales By Customer" and being aggregrated at the Order ID level for "Sales". If you remove Order ID, the two sales columns will match since the aggregration of "Sales" is being controlled by the visualization (i.e the dimensions placed on the row shelf).

### Syntax of LOD Expression

There are three LOD Tableau Keywords:

• FIXED is a LOD keyword that Tableau uses to fix the level of detail on the chosen dimension. The keyword FIXED makes Tableau ignore the other dimensions in the view.
• INCLUDE is a LOD keyword that Tableau uses to include the specified dimension in addition to dimensions in the visual.
• EXCLUDE is a LOD keyword that Tableau uses to omit the dimensions in the visual.

The general syntax for writing LOD expressions is


{FIXED [Name of Dimension] : SUM([Name of Measure])}


{INCLUDE [Name of Dimension 1], [Name of Dimension 2],...,[Name of Dimension N] : SUM([Name of Measure])}


{EXCLUDE [Name of Dimension 1], [Name of Dimension 2],...,[Name of Dimension N] : SUM([Name of Measure])}


The level of aggregration can be SUM, AVG, MEDIAN, COUNT, ATTR, etc

When using INCLUDE or EXCLUDE you can specify multiple dimensions. To Ignore all dimensions in the filter, surround the meaure with curly braces. For example:


{SUM([Sales])}


This will return all sales regardless of the dimensions in the visual.

• SEO