top of page
sonampriya07

Understanding Tableau LOD(Level of Detail) Expressions





About Tableau


Tableau helps people see and understand data. Tableau helps anyone quickly analyze, visualize and share information. More than 26,000 customer accounts get rapid results with Tableau in the office and on-the-go. And tens of thousands of people use Tableau Public to share data in their blogs and websites.


Tableau is one of the most powerful business intelligence tools on the market, their groundbreaking solutions help to present data in an informative way through charts and graphs. With its best-in-class functionalities, Tableau can handle data regardless of the level of complexity and transform intricate calculations into insightful visualizations. This is where we can use Level of Detail (LOD) calculations. 


What is LOD (Level of Detail) Expressions


Level of detail (LOD) expressions in Tableau represent an elegant and powerful way to answer questions involving multiple levels of granularity in a single visualization. LOD expressions can be performed at a more granular level (INCLUDE), a less granular level (EXCLUDE), or an entirely independent level (FIXED).


When should we implement LOD Calculations?

We can implement LOD calculations when we want to compute values involving many dimensions, without bringing all of these dimensions into our view. LODs are also useful when we want to aggregate values outside of the visualisation’s level of detail.


They also help to deal with duplicate records which might be caused when we have tables with one-to-many relationships. However, we can use the FIXED LOD calculation method to aggregate our values based on the dimensions we specify.


Another use for LOD calculations is when we want to isolate a value outside of the view we are building. For example, if we are looking to get a single aggregate of a value, the maximum sale price regardless of category or order date, LOD calculations come in handy as it can compute and retrieve the max sales value across all orders, regardless of the view we are building.


 *I have used the Superstore data set from Kagel for the example questions to explain each type of LOD calculation.


FIXED Level of Detail Expressions

We can use Fixed Level of detail calculations, when we need to isolate specific dimensions for calculations, regardless of the view's dimensions or filters

  • Find the regional sales.





  • Find the amount of Sales for each state in each region. It should show the state's sales and each region's sales without breaking down the sales into state sales. Here, first, create the formula field named Fixed Regional Sales using the formula shown in the following screenshot.






Next, drag the Region and State field to the Rows shelf and the calculated field to the Text shelf under the Marks card. Also, drag the Region field to the Color shelf. This produces the following view, which shows a fixed value for different states. That is because we have fixed the dimension as a region for the calculation of Sales value.


INCLUDE Level of Detail Expressions

Include Level of detail calculations allow you to include a dimension when you calculate a measure when you aggregate a measure.

  • This time, I want to show the maximum state sales in each region. So I am creating a calculated field;



If we drag out the state from the rows but still want to show which state has the maximum sale, we can see that by dragging the calculated field "Include State Sales" under the label mark.


EXCLUDE Level of Detail Expressions

EXCLUDE level of detail expressions specify dimensions to exclude from the view level of detail.

  • Exclude State from Sales figure. Create the formula as shown in the following screenshot.


I have dragged Region and State in rows. In the column, I have dragged two measures SUM(Sales) and SUM(Exclude State sales) so I have two marks now. The final view for the EXCLUDE LOD is shown in the following screenshot.


We can see that the first chart, displays each state's sales value per region, however, the second chart, displays the region's total sales for each state in that region.


Best Practices and Optimization Tips

Using LOD within Tableau is usually an intermediate to advanced technique, so it's important to have a good understanding of the data and how each type of expression works.


Here are some best practices and tips for using LOD expressions effectively:


  • Ensure that the dimensions used in your calculations align with those in the visualization.

  • Use FIXED expressions sparingly, as they can have a significant impact on performance.

  • Use INCLUDE and EXCLUDE expressions for calculations that involve multiple levels of detail.

  • Consider using LOD expressions in conjunction with other Tableau features, such as filters and sets, to gain even more control over the data.

  • Keep an eye on performance when using LOD expressions, as they can sometimes slow down the visualization. If performance becomes an issue, try simplifying the expression or using a different type of calculation.


LOD Expressions are a powerful new capability of Tableau 9.0 that allows us to easily solve problems

that previously required complicated formulas. They allow us to intuitively define the scope of

calculations and stay in a state of flow as we explore our data.


In conclusion, Tableau has many powerful capabilities with one of the highlights being LOD calculations.

With LOD calculations, we can compute values at different levels of detail from the level of detail in the

visualizations.


I hope, you find my blog about Tableau LOD expressions useful. If you have any concern, please share your thought. Thank you for taking your time to read my blog.


18 views

Recent Posts

See All
bottom of page