Level of detail expressions (which are sometimes also referred to as “LOD Expressions” or “LOD Calculations”) are an advanced analytics feature in Tableau. LOD Expressions are useful for cohort analysis or looking at averages or totals across segements.


When Tableau first released Level of Detail calculations, we provided an intro into Fixed Level of Detail calculations. Now that Tableau has upgraded to version 10, I wanted to spend time going into the other elements of LOD calculations and some updates that occurred with the upgrade.


Structure of a LOD Calculation

There are three types of LOD calculations:

  1. Fixed;
  2. Include;
  3. Exclude.

Regardless of which type you do; the syntax stays the same. Also, new in Tableau 10, you can use expressions on dimensions within the calculation. For example, previously if you wanted to use the year from a date field, you would have to create a separate calculated field in order to determine the year and then reference that calculated field within your LOD expression.

{(Fixed/Include/Exclude) <Dimension>, <Dimension>: <aggregation>}


{FIXED [State], YEAR([Event Date]): COUNTD([Registration Key])}


With a Fixed LOD, you specify the dimensions and the aggregation computes for those specific dimensions, regardless if these dimensions are on your visualization. If we use the formula above as an example, the distinct count of registrations will always happen per state, per year, even if you do not have state or event date on the visualization.


With an Include LOD, you specify dimensions, in addition to the dimensions in the view, to aggregate your measures against.


{INCLUDE year([Event Date]),[State Province Code]: AVG([Amount])}

If you do an average of amount, it will calculate the average amount per topic name. The LOD calculation does an average per year, state, and topic name.


With an Exclude LOD, you specify what dimensions including in the view, to exclude when you aggregate your measures.


{EXCLUDE [Topic Name]: AVG([Amount])}

In this example, the LOD calculation, will average per state and year and ignore the topic name.

Level of Detail calculations are very powerful tools to use within Tableau. It is easy to get stuck in one way of doing your analysis and visualizations. I hope this helps you think of new ways to attack your analysis.