A Practical Guide to using LODs in Tableau

Srutimala Deka
4 min readDec 3, 2023

--

How to use the most powerful feature in Tableau explained in three simple examples

LOD (Level of Detail) in Tableau

Every dataset comes with its own level of granularity. While analyzing the data an analyst would traditionally transform the data to the required granularity before use or perform complex calculations over the dataset.

In Tableau, when we drag and drop fields into view, the granularity is set at that level and all measures are aggregated on that level. To introduce a KPI which requires a different granularity without altering the visualization, LOD calculations are used.

Applying LODs to our Sales Use Case

Subset of Sales Data from Highest to Lowest Granularity

The dataset’s highest level of detail is REGION and most granular level is ORDER ID.

Tableau has three LOD types: Fixed, Include, Exclude

The general syntax is :

{ <LOD Keyword> <Dim A>, <Dim N> : <aggregation function> <Field X> }

FIXED LOD

We want to show Profit by Region and Ship Mode in a bar chart. In the same view, we want users to be able to compare this Profit to the total Profit for a given Region.

Fixed LODs are perfect for such comparison since we know EXACTLY which field we want to aggregate on and it should be influenced by no other field in the viz.

Fixed calculation
Green bars: Total Profit for entire Region, Black bars: Profit for both dimensions in view

It is clear from the viz that First Class shipping has low contributions to the overall Profit for Central Region.

INCLUDE LOD

Now we want to include a calculation that shows the maximum number of orders placed by a single customer for a given Region & Ship Mode.

Include LODs are perfect for this because we want to introduce a new field Customer ID to the calculation in addition to the fields already in view.

Include calculation
Max Orders Placed represented as circles

Here we did not use FIXED because we want the calculation to be influenced by the other dimensions in the view.

The Include LOD is calculated first (deeper level than the view) and then aggregated on the higher level of the view.

EXCLUDE LOD

Let’s add another dimension to the viz that goes one level deeper. The field Segment gives us product segments which were part of an Order ID.

But we are only interested to see Profit by other fields in the view except Segment. So we use Exclude LOD.

Exclude calculation
Extreme left: Profit by Ship Mode & Region only

Exclude LOD is useful when we want to exclude particular dimensions (lower level fields) from calculation’s granularity and only aggregate on higher granularity present in the view.

In the viz above we can see Profit is highest for West Region within First Class Ship Mode. Subsequent charts are influenced by Segment if they are NOT using Fixed LOD on another field or NOT explicitly excluding Segment.

For more knowledge on the topic refer to the whitepaper from Tableau

LODs give us great control and ease in calculation so it also requires careful consideration when using with filters. A separate blog will cover that in the upcoming months.

UPDATE: The next blog is live!

Connect with me on LinkedIn

--

--