Level of Detail Part 2: Syntax & Order of Operations

In the part one of this series we looked at what Level of Detail is in Tableau and mentioned how LoD calculations enable us to aggregate values on our own terms regardless of what is in the view. In this blog we will explore in more detail the different types of LoD calculation and how to create them in Tableau.

 

syntax

 

Level of Detail Syntax

  • The first point to make about the syntax of LoD calculations is that they must always be surrounded by curly braces which will turn blue to indicate you are on the right track.
  • LoD expressions must also always start with one of the 3 scoping keywords – Fixed, Include and Exclude – which determine how the aggregation will be performed (full explanation of each in pt. 3).
  • Enter the dimension(s) that you want the expression to affect before a separating colon.
  • Finish off the calculation with the measure that you want to aggregated (you must specify the aggregation in the expression

 

Order of Operations

I personally think Fixed is the easiest of the scoping keywords to use and a lot of the time it can be used in the place of either of the other two. However the scoping keywords are affected differently by filters due to the order of operations in which calculations are performed so a Fixed expression will not always be right for the situation.

As the following diagram shows Fixed expressions come before dimension filters so will ignore any filter in the shelf unless it is put in context.  If you want your calculation to be affected by what you’ve dropped in as a filter then you will have to use Include or Exclude.

 

order-of-ops

 

 

 

 

 

 

Author:
Peter Silvester
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab