Understanding EXCLUDE LOD

The EXCLUDE LOD expression is just the opposite of the INCLUDE LOD expression. As mentioned earlier, EXCLUDE LOD computes the values by omitting the dimensions from the view level of detail and it is most useful when excluding a dimension as the results are computed at a higher granularity than the visualization's level of detail.

The syntax of using the EXCLUDE LOD expression is { EXCLUDE [Dimension] : aggregate expression}.

The preceding syntax shows how one can use an EXCLUDE expression for a single dimension; however, if there is more than one dimension that we want to include in our calculation, then the syntax can be modified as { EXCLUDE [Dimension1], [Dimension2], [Dimension3] : aggregate expression}.

Let us see how we can use the EXCLUDE LOD expression in the following recipe.

Getting ready

Let us use the Category, Sub-Category, and Sales fields from the Orders sheet of Sample - Superstore.xlsx data.

How to do it…

  1. Let us start by duplicating the previous sheet, that is, INCLUDE LOD and let us rename it as EXCLUDE LOD.
  2. Let us then drag the Category field from the Dimensions pane and drop it just before the Sub-Category field in the Rows shelf.
  3. As a next step, let us remove the Include Region-Average Sales and the Average Sales fields from the view. We will then drag the Sales field from the Measures pane and drop it into the Text shelf.
  4. We will then create a new calculated field called Exclude Subcategory-Sum of Sales and the formula will be SUM({EXCLUDE [Sub-Category]:SUM([Sales])}).
  5. Let us click OK and then double click on the new calculated field to fetch it into our view. Our view will then be updated, as shown in the following screenshot:
    How to do it…

How it works…

In the preceding recipe, Exclude Subcategory-Sum of Sales excludes the granularity of the sub-category even though it is part of the view and computes the sum of sales at the category level.

To know more about EXCLUDE LOD, refer to https://onlinehelp.tableau.com/current/pro/desktop/en-us/calculations_calculatedfields_lod_exclude.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.137.12