Select Page

Tableau LOD expressions and data granularity

In this blog, I will have a short and general look at various levels of data granularity with Tableau’s Level of Detail Expressions. This is a brief summary about Data Granularity, level of details expressions and order of operations in Tableau.

Granularity

Data granularity is the level of detail in a model or decision-making process. It tells you how detailed your data is.

When we aggregate the data, we take multiple values and present them as a single value, so we decrease the level of detail. For example, the total sum of sales is 268K in all regions and years, is a high-level aggregation. When we add dimensions to the table, such as Region and Years, we increase the data granularity and increase the number of data points in our view.

LOD Expressions in Tableau

LOD expressions – Tableau’s elegant and powerful way to easily compute aggregations that are not at the level of detail of the visualization. There are 3 LOD functions: FIXED, INCLUDE and EXCLUDE. Through these functions you control the level of detail at which a calculation is performed and do not depend on dimensions used in the visualization. Letâ€™s summaries the 3 LOD functions:

FIXED: Calculating at an exactly specified level of detail

Examples:

• Calculating Measures between various time dimensions:

{FIXED [Week]: sum (Sales)}

• Calculating per Categories:

{FIXED [Product]: sum (Cost)} / {FIXED: sum (Cost)}

• Computing First or last data point per data subject:

{FIXED [Customer]: Min (Order Date)}

INCLUDE: Calculating at a lower level of detail

Examples:

• Calculating at a closer level of detail than in database:

{INCLUDE [Product], [Region]: sum (Sales)}

EXCLUDE: Calculating at a higher level of detail

Examples:

• Calculating at a larger level of detail than the one present in the view

{EXCLUDE [Product], [Region]: sum (Sales)}

Order of operations in Tableau:

If we have a quick look at Tableauâ€™s order of operations, Tableau executes the filters in the calculations, starting with the extract filters, and then going from top to bottom.

https://help.tableau.com/current/pro/desktop/en-us/order_of_operations.htm