---
title: LOD Use Case - Replacing a Window Average with a LOD
description: "Part of my (daily) job is to answer the questions that our clients submit at the support portal of The Information Lab. Last week I received the following question: “I..."
---

[DDBM Blog ](https://www.ddbm.com/blog)

# [LOD Use Case - Replacing a Window Average with a LOD](https://www.ddbm.com/blog/2017/01/23/lod-use-case-replacing-window-average-lod)

 Geschreven door [Valantis Vasilakis](https://www.ddbm.com/blog/author/valantis-vasilakis) | 22 Jan, 2017

Part of my (daily) job is to answer the questions that our clients submit at the support portal of The Information Lab. Last week I received the following question:

“I managed to create a table calculation which shows the Profit / Quantity ratio per country. However, I didn’t manage to present the window average of all countries in a text box like the other KPI’s within the Management dashboard. When I take the country out of the Row shelf my average is no longer correct. How can I solve this?”

The answer lies within the Level of Detail (LOD) expressions. The LOD expressions allow us to create calculations at a level of detail other than the view level.

But let’s start from the very beginning. Using the EU Superstore, I created the initial calculation which is:

#### Window Average

Then the window average:

I placed both in the view and made sure that the Window Average computes using Table down:

(Note that I have selected 0 decimal places for all measures in the workbook)

The result is an average [Profit / Quantity ratio] of 4 considering all the countries included in the dataset: ((22+20-19+19…+18) / 15) which equals to 4.

Now if you want to present the value of 4 in a text box as a KPI and take the Country field out of the Rows, the [Profit / Quantity ratio] becomes 10 instead of 4:

The reason is that without the Country field as a level of detail, the calculation SUM(Profit) / SUM(Quantity) now becomes (372,830 / 37,773) = 10.  In addition, we have only 1 row in the table and thus the value of the Window Average is the same: 10.

#### Level Of Detail Expressions in Tableau

I fixed this by using a LOD calculation:

Afterwards, I created a new worksheet and placed the LOD calculation in the view:

The value of 4 for the Profit / Quantity ratio is right there!

The reason is that the LOD expression calculates the [Profit / Quantity ratio] for every country in the dataset even if the Country field is not in the view. This is happening because I have put the Country field in the first half of my LOD calculation! Therefore, Tableau calculates ((22+20-19+19…+18) / 15) in the background and not (372,830 / 37,773).

You can find the resulting workbook [here](https://public.tableau.com/profile/valantis#!/vizhome/LODUseCase-ReplacingaWindowAveragewithaLOD/Story) if you want to take a look.

PS. Details regarding the LOD expressions can be found [here](https://onlinehelp.tableau.com/current/pro/desktop/en-us/calculations_calculatedfields_lod_overview.html).

[Volledig bericht weergeven](https://www.ddbm.com/blog/2017/01/23/lod-use-case-replacing-window-average-lod)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Valantis Vasilakis"
  },
  "dateModified" : "2026-02-11T09:53:04.147Z",
  "datePublished" : "2017-01-22T23:00:00Z",
  "headline" : "LOD Use Case - Replacing a Window Average with a LOD",
  "image" : {
    "@type" : "ImageObject",
    "height" : 60,
    "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
    "width" : 60
  },
  "mainEntityOfPage" : "https://www.ddbm.com/blog/2017/01/23/lod-use-case-replacing-window-average-lod",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "DDBM Blog"
  }
}
```