LibraryTable Calculations and Level of Detail

Table Calculations and Level of Detail

Learn about Table Calculations and Level of Detail as part of Business Intelligence and Advanced Data Analytics

Mastering Tableau: Table Calculations and Level of Detail

Welcome to this module on advanced Tableau features: Table Calculations and Level of Detail (LOD) expressions. These powerful tools allow you to perform complex analyses, aggregate data at different granularities, and create sophisticated visualizations that go beyond simple row-level calculations.

Understanding Level of Detail (LOD) Expressions

Level of Detail (LOD) expressions allow you to compute aggregations at a specified level of detail, independent of the dimensions present in the view. This means you can calculate values at a coarser or finer grain than the visualization's default level.

LODs let you control aggregation granularity.

LOD expressions enable calculations at different levels of detail than what's shown in the visualization. They are defined using keywords like INCLUDE, EXCLUDE, and FIXED.

There are three main types of LOD expressions:

  • FIXED: Computes a value at the specified dimensions, regardless of other dimensions in the view. For example, {FIXED [Customer Name] : SUM([Sales])} calculates the total sales for each customer, even if the view is broken down by product category.
  • INCLUDE: Computes a value at the specified dimensions plus any dimensions in the view. For example, {INCLUDE [Product Name] : SUM([Sales])} calculates total sales for each product, considering the dimensions in the view alongside Product Name.
  • EXCLUDE: Computes a value at all dimensions in the view except for the specified dimensions. For example, {EXCLUDE [Region] : SUM([Sales])} calculates total sales excluding the Region dimension, effectively showing sales aggregated at a higher level.
What is the primary purpose of a FIXED LOD expression?

To compute a value at specific dimensions, independent of other dimensions in the view.

Exploring Table Calculations

Table calculations operate on the data that is already present in the visualization's table. They are computed after the row-level and aggregate calculations have been performed. This makes them ideal for calculations like running totals, moving averages, percent of total, and ranking.

Table calculations work on the data in the view's table.

Table calculations are computed on the aggregated data within the visualization. They are defined by 'Compute Using' settings, which dictate the dimensions across which the calculation is performed.

Table calculations have a 'Compute Using' property that determines the dimensions over which the calculation is applied. This can be set to specific dimensions, or to 'Table (across)', 'Table (down)', 'Pane (across)', 'Pane (down)', or 'Cell'. Understanding these settings is crucial for achieving the desired results. For instance, a running total of sales by date would typically 'Compute Using' the Date dimension.

FeatureLevel of Detail (LOD) ExpressionsTable Calculations
Calculation ScopeIndependent of view dimensions; can aggregate at any level.Operates on data already in the view's table.
Granularity ControlExplicitly defined using FIXED, INCLUDE, EXCLUDE.Controlled by 'Compute Using' settings on dimensions in the view.
Use CasesComparing aggregations across different levels (e.g., sales per customer vs. total sales).Running totals, moving averages, percent of total, ranking.
Order of OperationsCalculated before dimension filters (except context filters).Calculated after most other operations, including dimension filters.

Visualizing the difference between LOD and Table Calculations can be helpful. LODs allow you to 'reach into' the data and aggregate it at a different level, like calculating the average sales per customer and then displaying that average alongside individual customer sales. Table Calculations, on the other hand, work with the data already laid out in your table. Imagine a table of monthly sales; a table calculation could show the percentage change from the previous month, operating directly on those monthly figures.

📚

Text-based content

Library pages focus on text content

Remember the Tableau Order of Operations! LOD expressions are generally evaluated before dimension filters (except context filters), while table calculations are evaluated much later in the process.

Practical Application and Best Practices

When to use LODs vs. Table Calculations often depends on the specific analytical question. If you need to compare values at different granularities that aren't directly represented in your view, LODs are usually the answer. If you need to perform calculations based on the relative position or aggregation of data within your current view, table calculations are more appropriate.

When would you choose a Table Calculation over an LOD expression?

When you need to perform calculations based on the relative position or aggregation of data within the current view, such as running totals or moving averages.

Learning Resources

Tableau's Level of Detail Expressions Explained(video)

A comprehensive video tutorial from Tableau demonstrating the power and application of LOD expressions.

Table Calculations in Tableau(video)

Learn how to use table calculations to perform advanced analysis, including running totals, percent of total, and more.

Understanding Level of Detail (LOD) Expressions in Tableau(documentation)

The official Tableau documentation detailing the syntax, types, and use cases of LOD expressions.

Table Calculations(documentation)

Official Tableau help documentation covering the fundamentals and advanced usage of table calculations.

Mastering Tableau's LOD Expressions: A Deep Dive(blog)

A blog post offering insights and practical examples for effectively using LOD expressions in Tableau.

Tableau Table Calculations: A Comprehensive Guide(blog)

An article that breaks down table calculations, explaining their importance and how to implement them.

Tableau LOD vs. Table Calculations: When to Use Which(blog)

A comparative analysis to help you decide whether to use LOD expressions or table calculations for your specific needs.

Level of Detail (LOD) Expressions(wikipedia)

While not specific to Tableau, this provides a general understanding of Level of Detail concepts in computing and graphics.

Advanced Table Calculations in Tableau(blog)

This resource explores more complex scenarios and techniques for leveraging table calculations in Tableau.

Tableau LOD Expressions: FIXED, INCLUDE, EXCLUDE(blog)

A detailed breakdown of each LOD type with clear examples and explanations.