What Are LODs?
LODs, or Level of Detail expressions, are a powerful capability within Tableau that allow you to perform calculations at different levels of detail in your data; regardless of which dimensions are within your view.
Think of it this way: Normally when you create a visualization in Tableau, the level of detail is determined by the dimensions included. LODs give you the ability to break free from this constraint and perform calculations at a level of detail specified by you, meaning it can be different from what your visualization displays.
Why Are LODs Important?
LODs open up a whole new world of possibilities when it comes to data analysis. They enable you to aggregate or evaluate data based on specific dimensions, regardless of the dimensions included in your view. This means you can perform calculations that span different levels of detail, and gain deeper insights into your data.
In this blog we will be focusing on fixed LOD expressions.
Fixed LOD expressions allow you to define a specific level of detail in your calculation, regardless of the dimensions in your visualization. You can isolate particular dimensions and perform calculations exclusively on that fixed level of detail.
The Syntax for a fixed LOD expression is
{FIXED [Dimension] : Aggregate}
The dimensions field is optional, if left blank the calculation will be applied to the entire dataset without any specific dimension. This is known as a global LOD calculation. This can be useful in scenarios where you want to calculate a metric across the entire dataset, regardless of specific dimensions.
For example, using the superstore data the calculation SUM(Sales) will yield the same value as {FIXED : SUM(Sales)} as shown in the image below.
When we introduce the categories dimension to the view, the difference between the two calculations becomes apparent.
In the image below we see that the SUM(Sales) calculation becomes more detailed as the category dimension is added, providing insights specific to each category. On the other hand, the LOD calculation we created, which calculates the sum of sales across all fields, remains consistent regardless of the dimension in view.
In a real use case scenario imagine you want to calculate the percent of total orders placed per weekday.
To do this, you would first need to create a LOD of count distinct of order ID's this will give you the total number of orders across the entire dataset.
You can then calculate the percent of orders per weekday by dividing the count distinct of order ID's (which is not fixed) by the fixed value of the count distinct of order ID's that you calculated earlier in order to get the total number of orders.
In conclusion, Level of Detail expressions (LODs) in Tableau provide a powerful capability to perform calculations at different data levels, regardless of the dimensions in the view. By using fixed LOD expressions, specific levels of detail can be defined for calculations, allowing for consistent metrics even as dimensions are added to the visualization. This flexibility opens up new possibilities for data analysis, offering deeper insights and enabling users to conduct granular examinations. For instance, when calculating the percentage of total orders placed per weekday, fixed LODs determine the reference point for the total order count across the entire dataset, leading to valuable insights into order distribution patterns.