Reading time: 15 minutes
Level of difficulty: Difficult
Objective: Understanding LOD (Level Of Detail) calculations
When working with Tableau, calculations are done at the view level. That makes sense because they match the information you're presenting. For example, if you analyze your data at the regional level, it is normal for your calculations, such as the sum of sales, to be done at the regional level.
But what if the calculation you want to perform needs to be done at a different level of detail than the view?
Let's say you have a graph showing the sum of sales by region, but you also want to show, in the tooltip, the sum of sales by country to allow the user to compare regional performance to the national level. This is where LODs (Level of Detail) come in. They allow you to adjust the level of detail of a calculation, independently of that of the view.
1. FIXED : This type of calculation is ideal for setting a constant level of detail, regardless of the structure of the view. For example, if you want to calculate the sum of sales by country while analyzing sales by region, you would use a FIXED LOD to ensure that the calculation stays at the country level.
2. INCLUDE : This calculation allows you to add additional details to your aggregations without necessarily including them in the view. In practice, it allows you to take into account a specific field in your calculation, without making it visible in the visualization. This enriches your analysis while keeping the view simple and readable.
3. EXCLUDE : As the name suggests, this calculation excludes certain dimensions from your view. This is useful when you want to simplify the results by omitting specific information that could complicate the display, while maintaining most of the analysis.
NB : INCLUDE and EXCLUDE rely on the view by adding or removing one or more levels of detail, while FIXED ignores the view level to perform the calculation.
Reminder : The level of detail of a view corresponds to the dimensions used in the view. If you are in doubt, simply ask yourself what dimensions would be present if your graph were in table form.
On these images we have the same information in 2 different formats, we can see that the level of detail of the views is “Sub-Category”:
You may still find it all a bit abstract, and that's normal. With practice, these concepts will become clearer. In the following example, we'll show you step-by-step how to use these functions to adjust the level of detail in your calculations.
Objective: Display the sum of sales by Country, State, Region
Objective: Exclude the State dimension from the sum of sales.
In tabular format, we can see a little better what is going on:
Objective: Show the average sales per customer (Customer ID) without adding this field to the view.
How does it work?
LOD calculations may seem complex at first, but they are very useful for comparing different levels of data. Take the time to fully understand the granularity of your view and start by organizing your data and doing your calculations in a table before turning them into a graph. This will allow you to clearly visualize what level of detail you are at so as not to get lost during the calculations.
If you have any questions or specific needs, do not hesitate to contact us!