Bird
Raised Fist0
Tableaubi_tool~15 mins

EXCLUDE LOD expression in Tableau - Real Business Scenario

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Scenario Mode
👤 Your Role: You are a sales analyst at a retail company.
📋 Request: Your manager wants to see the average sales per customer, excluding the effect of product categories, to understand customer spending behavior better.
📊 Data: You have sales transaction data including Customer ID, Product Category, Sales Amount, and Order Date.
🎯 Deliverable: Create a Tableau dashboard showing average sales per customer excluding product category detail using EXCLUDE LOD expression.
Progress0 / 6 steps
Sample Data
Customer IDProduct CategorySales AmountOrder Date
C001Electronics2002024-01-10
C001Clothing1502024-01-15
C002Electronics3002024-01-12
C002Clothing1002024-01-20
C003Electronics2502024-01-18
C003Clothing2002024-01-22
C004Electronics4002024-01-25
C004Clothing3002024-01-28
1
Step 1: Connect your sales data to Tableau and load the data source.
No formula needed.
Expected Result
Data source with Customer ID, Product Category, Sales Amount, and Order Date is ready in Tableau.
2
Step 2: Create a calculated field to compute total sales per customer excluding product category detail using EXCLUDE LOD expression.
Name: Total Sales per Customer Excluding Category Formula: {EXCLUDE [Product Category] : SUM([Sales Amount])}
Expected Result
Calculated field that sums sales per customer ignoring product category.
3
Step 3: Create another calculated field to count distinct customers.
Name: Distinct Customers Formula: COUNTD([Customer ID])
Expected Result
Calculated field that counts unique customers.
4
Step 4: Create a calculated field for average sales per customer excluding product category.
Name: Avg Sales per Customer Excl Category Formula: SUM([Sales Amount]) / COUNTD([Customer ID])
Expected Result
Calculated field showing average sales per customer ignoring product category.
5
Step 5: Build a view: Drag Customer ID to Rows, and the 'Total Sales per Customer Excluding Category' calculated field to Text on Marks card.
No formula needed.
Expected Result
Table showing total sales per customer ignoring product category.
6
Step 6: Create a dashboard and add the view. Add a title 'Average Sales per Customer Excluding Product Category'.
No formula needed.
Expected Result
Dashboard displays average sales per customer ignoring product category detail.
Final Result
Dashboard: Average Sales per Customer Excluding Product Category

+-------------+-----------------------------+
| Customer ID | Total Sales Excluding Category |
+-------------+-----------------------------+
| C001        | 350                         |
| C002        | 400                         |
| C003        | 450                         |
| C004        | 700                         |
+-------------+-----------------------------+

Average Sales per Customer (Excl Category): 475
✓When ignoring product categories, average sales per customer is $475.
✓Customer C004 spends the most overall, regardless of product category.
✓EXCLUDE LOD expression helps analyze customer spending without product category influence.
Bonus Challenge

Create a similar EXCLUDE LOD calculation to find average sales per product category excluding customer detail.

Show Hint
Use {EXCLUDE [Customer ID] : SUM([Sales Amount])} to ignore customer level detail.

Practice

(1/5)
1. What does the EXCLUDE LOD expression do in Tableau?
easy
A. It filters data based on a condition.
B. It adds extra dimensions to the view for detailed analysis.
C. It removes specified dimensions from the view to aggregate data at a higher level.
D. It creates a calculated field that sums all values.

Solution

  1. Step 1: Understand the purpose of EXCLUDE LOD

    EXCLUDE LOD removes certain dimensions from the calculation, simplifying the aggregation.
  2. Step 2: Compare with other options

    Adding dimensions or filtering is not what EXCLUDE does; it specifically ignores dimensions.
  3. Final Answer:

    It removes specified dimensions from the view to aggregate data at a higher level. -> Option C
  4. Quick Check:

    EXCLUDE = remove dimensions [OK]
Hint: EXCLUDE means ignore some dimensions to see bigger picture [OK]
Common Mistakes:
  • Confusing EXCLUDE with INCLUDE or FIXED LOD
  • Thinking EXCLUDE filters data instead of changing aggregation level
  • Assuming EXCLUDE adds dimensions instead of removing
2. Which of the following is the correct syntax for an EXCLUDE LOD expression in Tableau?
easy
A. {EXCLUDE [Category] : SUM([Sales])}
B. EXCLUDE {SUM([Sales]) : [Category]}
C. {INCLUDE [Category] : SUM([Sales])}
D. SUM({EXCLUDE [Category] : [Sales]})

Solution

  1. Step 1: Recall the correct LOD syntax

    The correct syntax is curly braces with EXCLUDE, then the dimension in brackets, colon, and aggregation.
  2. Step 2: Check each option

    {EXCLUDE [Category] : SUM([Sales])} matches the correct syntax. Options A, B, and C have syntax errors or wrong order.
  3. Final Answer:

    {EXCLUDE [Category] : SUM([Sales])} -> Option A
  4. Quick Check:

    LOD syntax = {EXCLUDE [Dimension] : Aggregation} [OK]
Hint: LOD expressions always use curly braces and colon [OK]
Common Mistakes:
  • Placing EXCLUDE outside curly braces
  • Swapping INCLUDE and EXCLUDE keywords
  • Incorrect order of aggregation and dimensions
3. Given the view shows sales by [Region] and [Category], what does this expression return?
{EXCLUDE [Category] : SUM([Sales])}
medium
A. Total sales for each Region ignoring Category breakdown
B. Total sales for each Category ignoring Region breakdown
C. Total sales for each Region and Category combined
D. Total sales for all data ignoring Region and Category

Solution

  1. Step 1: Identify dimensions in the view

    The view has Region and Category dimensions.
  2. Step 2: Understand EXCLUDE [Category]

    EXCLUDE removes Category from calculation, so aggregation is by Region only.
  3. Final Answer:

    Total sales for each Region ignoring Category breakdown -> Option A
  4. Quick Check:

    EXCLUDE Category = aggregate by Region only [OK]
Hint: EXCLUDE removes dimension from aggregation level [OK]
Common Mistakes:
  • Thinking EXCLUDE filters data instead of changing aggregation
  • Confusing which dimension is excluded
  • Assuming it sums all data ignoring all dimensions
4. You wrote this EXCLUDE LOD expression:
{EXCLUDE [Region] : SUM([Profit])}
But Tableau shows an error. What is the likely cause?
medium
A. You forgot to include curly braces around the expression.
B. You cannot exclude a dimension not present in the view.
C. The syntax is correct; the error is due to missing data.
D. You must use INCLUDE instead of EXCLUDE for aggregation.

Solution

  1. Step 1: Check the syntax of the expression

    The syntax is correct, including curly braces.
  2. Step 2: Identify the error cause

    EXCLUDE LOD can only exclude dimensions present in the view; if [Region] is absent, it errors.
  3. Final Answer:

    You cannot exclude a dimension not present in the view. -> Option B
  4. Quick Check:

    EXCLUDE requires dimension in view [OK]
Hint: EXCLUDE only for dimensions in the view [OK]
Common Mistakes:
  • Assuming curly braces are missing
  • Confusing EXCLUDE with INCLUDE
  • Overlooking that excluded dimension must be in the view
5. You have sales data by [Region], [Category], and [Sub-Category]. You want to see total sales by Region only, ignoring Category and Sub-Category. Which EXCLUDE LOD expression achieves this?
hard
A. {EXCLUDE [Category] : SUM([Sales])}
B. {EXCLUDE [Region] : SUM([Sales])}
C. {EXCLUDE [Sub-Category] : SUM([Sales])}
D. {EXCLUDE [Category], [Sub-Category] : SUM([Sales])}

Solution

  1. Step 1: Identify dimensions to exclude

    You want to ignore both Category and Sub-Category to aggregate by Region only.
  2. Step 2: Write EXCLUDE with both dimensions

    Use EXCLUDE with both [Category] and [Sub-Category] inside curly braces.
  3. Final Answer:

    {EXCLUDE [Category], [Sub-Category] : SUM([Sales])} -> Option D
  4. Quick Check:

    Exclude both dimensions to aggregate by Region [OK]
Hint: List all dimensions to exclude inside EXCLUDE brackets [OK]
Common Mistakes:
  • Excluding only one dimension when two are needed
  • Excluding Region instead of Category/Sub-Category
  • Incorrect syntax with missing commas