Analytics

Level of Details Expressions In Tableau Simplified

Introduction

In daily communication, people often use some terminologies like high level knowledge and  low level information about a thing. This is true in almost everything we do. The level of details or level of granularity in data gives context to the data. For a time series analysis, it give upto to the second information. In this article we will go through how to use Tableau to demystify the concept of LOD using Level Of Details Expressions. We will explain LOD expression in Tableau under the following headers

  • What are Level Of Details Expressions
  • Syntax
  • Types of Level Of Details
  • Examples

What Are Level of Details Expressions

According to Tableau documentation, Level of Details expression (LOD expressions) allows you to compare values at the source level and the visualization level. However, LOD expressions give you even more control on the level of granularity you want to compute. The can be performed at a more granular level(INCLUDE), a less granular level (EXCLUDE), or an entirely independent level (FIXED). To simply put it, LOD expression allows you to control the smallest detail in the data. It helps you find out what each number or aggregation of numbers represents.

To explain granularity in terms of levels of details, we can categorize them into high-level and low-level details.

A high-level information often leaves out important details while low-level information gets you down into the details.

The information simply explains the sum of sales at the high level and the low level. So the low-level gives more detail of how the regions contributed to the total sum.

High Level DetailLow Level Detail
Leaves out detailsAdds the details
Gives SummaryGives more details
It’s less granularIt’s more granular
It’s more aggregatedIt’s is less aggregated

In Tableau, the way the LOD works is that every number displayed on the sheet is a level of detail as shown in fig 1.1 and fig 1.2. The first figure gives the sum of sales for the entire transactions while the second figure shows a different granularity, which is the sum of sales at the region level. We can also go one level lower to the sum of sales at the state level if we so wish.

Syntax

Regardless of the type of LOD you choose, the syntax remains the same. Here is the syntax

{TYPE [Dim List] : AGGREGATE}

The entire LOD is enclosed in a curly bracket. The first entry is the type of LOD, The second entry is the optional dimension(s). The square bracket indicates that it is optional. While the last entry is the aggregation.

Types of Level Of Details

In Tableau, there are three types of LOD. They are:

FIXED

EXCLUDE

INCLUDE

FIXED LOD

This type of LOD computes a value using the specified dimension without making reference to it in view.

This give it the capability to return a scalar, hence it is independent of the dimensions in view. To create a FIXED LOD, we open the create calculated field panel and type {FIXED  : SUM([Sales])}

This expression create a FIXED LOD that is completely independent of any dimensions.

In the figure above, I created a FIXED LOD and displayed it on a table, then introduced a dimension called region. Notice how the native Tableau behavior affected the Sales column, but the Fixed Sum of Sales column remained the same. That is because when I created the FIXED LOD, I didn’t use any dimension.

Another variation of FIXED LOD is the FIXED Table-Scoped LOD, this happens when the type of LOD and dimensions were not given. Whenever this happens Tableau treats it as a FIXED LOD.

Exclude LOD

Just as the name indicates, the exclude LOD declares the dimension to remove from the view level of details. That is, dimension in view minus the dimension(s) declared in the expression. It returns its value as an attribute function. Exclude LOD is affected by dimension filters.

To create this, we follow the method as was in Fixed LOD, but this time, it is important to state the dimension to be excluded. The image below show that Region being the excluded dimension is not affected by the LOD expression but every other dimension can be affected. 

Sometimes there might be need to exclude more than one dimension, to do this, simply introduce the second dimension and separate them with a comma. 

Include LOD

The Include LOD is the like the Exclude LOD, in this case, where the Exclude LOD declares the dimension(s) not to be added to the filter, the Include LOD tells you of the dimensions to be added. It returns the result in attribute function and it is affected by dimension filter. Include LOD compute values using the specified dimensions in addition to whatever dimensions are in the view. It can be useful when you want to calculate at a fine level of detail in the database and then reaggregate and show at a coarser level of detail in your view.

Kingsley Ihemere

I am a detailed and self-motivated Business Intelligence Analyst with diverse experience in Database, ETL and analytical tools and web frameworks. I excel at team leadership, modern BI technologies, data analytics and technical writing. I am offering over 5years of experience in improving business operations through data and software development. Have you got data to explore? Let's talk about it. Send me an email via kingsley@dekings.dev

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button