Flerlage Twins: 20 Uses for Level-of-Detail Calculations
An interactive tool to understand Tableau’s powerful LOD expressions.
Choose a scenario to see how a FIXED LOD changes the aggregation.
Calculating…
Intermediate Values
Formula Explanation
What are the Flerlage Twins 20 Uses for Level-of-Detail Calculations?
The “Flerlage Twins 20 Uses for Level-of-Detail Calculations” refers to an influential blog post by Tableau Zen Masters Ken and Kevin Flerlage. This article outlines twenty practical scenarios where Tableau’s Level of Detail (LOD) expressions can solve common and complex data problems. LODs allow you to compute aggregations at a level of detail that is different from the visualization’s level of detail. In simpler terms, they let you ask more complex questions of your data, like finding a customer’s first purchase date and then analyzing sales just from that date, even while your main view shows monthly sales.
This concept is crucial for anyone moving from basic to advanced data analysis in Tableau. Understanding LODs, especially the common FIXED type, unlocks the ability to perform cohort analysis, comparative analysis (like a subset to a superset), and deal with data duplication issues. While powerful, a common misunderstanding is thinking they are just complex filters; in reality, they create new, virtual layers of aggregated data that can be used independently in your visualizations. For more on the fundamentals, see this guide on Tableau LOD examples.
The {primary_keyword} Formula and Explanation
LOD expressions have a specific syntax. The most common type, FIXED, computes a value using the specified dimensions, regardless of what other dimensions are in the view. The calculator above primarily uses logic analogous to a FIXED LOD.
The general syntax for a FIXED LOD is:
{ FIXED [Dimension 1], [Dimension 2] : AGGREGATE([Measure]) }
For example, to find the first order date for each customer (as in our first use case), the Tableau formula would be { FIXED [Customer Name] : MIN([Order Date]) }. This tells Tableau: “For each unique customer, find the minimum order date and return that single date for all of that customer’s rows.” This result can then be used in other calculations.
Variables Table
| Variable | Meaning | Unit (Auto-inferred) | Typical Range |
|---|---|---|---|
[Dimension] |
A categorical field to group by. | Text / Date / Geographic | e.g., ‘Customer Name’, ‘Region’, ‘Product Category’ |
AGGREGATE |
The aggregation function to perform. | Function | e.g., SUM, AVG, MIN, MAX, COUNTD |
[Measure] |
The numerical field to be aggregated. | Number (Currency, Count, etc.) | e.g., ‘Sales’, ‘Profit’, ‘Quantity’ |
Practical Examples
Example 1: Finding Total Sales on First-Ever Order Dates
This example mirrors the first function of our calculator. Imagine a dataset of customer orders. We want to know the total value of sales that occurred only on each customer’s very first purchase date.
- Inputs: A list of orders with Customer Name, Order Date, and Sales.
- Units: Customer (Text), Order Date (Date), Sales (Currency).
- LOD Logic:
- First, for each customer, find their minimum order date:
{ FIXED [Customer Name] : MIN([Order Date]) }. - Then, sum sales only for rows where the order date matches this first date:
SUM(IF [Order Date] = [First Order Date LOD] THEN [Sales] END).
- First, for each customer, find their minimum order date:
- Result: A single currency value representing the total sales from all customers’ initial purchases. This is a key metric in customer cohort analysis.
Example 2: Comparing a State’s Average Sale to the National Average
This illustrates comparing a subset to a superset. We want to see how the average sale in California compares to the average sale across the entire country.
- Inputs: A list of orders with State and Sales.
- LOD Logic:
- Calculate the national average sale, ignoring the state dimension:
{ FIXED : AVG([Sales]) }. This is a table-scoped LOD. - Create a view showing
AVG(Sales)by State. - You can then display both the state average and the national average side-by-side for comparison.
- Calculate the national average sale, ignoring the state dimension:
- Result: You can create a new metric like `(AVG([Sales]) / [National Average LOD]) – 1` to see the percentage difference for each state from the national average, a powerful data visualization technique.
How to Use This Flerlage Twins LOD Calculator
This calculator simulates how a Level-of-Detail calculation works on a sample dataset. It helps you build an intuition for how LODs transform data.
- Select a Use Case: Start by choosing one of the pre-configured use cases from the dropdown menu. Each one demonstrates a different concept from the Flerlage Twins’ list.
- Observe the Primary Result: The large number at the top shows the final, aggregated output of the LOD-based calculation.
- Examine Intermediate Values: The tables below the result show the underlying data and the intermediate steps the calculation took. For instance, you might see a table listing the first purchase date found for each customer.
- Understand the Formula: The “Formula Explanation” section describes, in plain English and pseudo-code, what the calculation is doing.
- Interpret the Chart: The canvas chart at the bottom provides a visual representation of the results, making it easier to compare values or see distributions. The chart will update dynamically as you change the selected use case.
Key Factors That Affect Flerlage Twins 20 Uses for Level-of-Detail Calculations
- Data Granularity: The level of detail of your source data (e.g., daily transactions vs. monthly summaries) directly impacts what an LOD can compute.
- Tableau’s Order of Operations: This is a critical factor. FIXED LODs are computed before regular dimension filters. This means a filter on ‘Product Category’ will NOT affect a
{FIXED [Customer]:...}calculation unless you “Add to Context”. A deep understanding is needed for accurate results. - Dimensions in the Declaration: The dimensions you list after the
FIXEDkeyword determine the aggregation level.{FIXED [Region]:...}calculates a value per region, while{FIXED [Region], [Category]:...}calculates a value for each combination of region and category. - INCLUDE vs. EXCLUDE: Besides
FIXED, there areINCLUDEandEXCLUDELODs. They are relative to the dimensions in the view and are calculated after dimension filters, giving them more flexibility in some scenarios. - Performance: While powerful, complex or numerous LODs can slow down your dashboards, as they may require additional queries to the data source. Check our guide on advanced Tableau tips for optimization.
- Aggregation Type: The choice of
SUM,AVG,MIN,MAX, orCOUNTDinside the LOD is fundamental to the question you are asking. UsingAVGvs.SUMwill produce vastly different results.
Frequently Asked Questions (FAQ)
1. What’s the main difference between a FIXED LOD and a regular filter?
A regular dimension filter removes rows from your data. A FIXED LOD computes an aggregation before the dimension filter is applied, meaning it can “see” data that the rest of your visualization can’t.
2. When should I use INCLUDE instead of FIXED?
Use INCLUDE when you want to calculate something at a more granular level than your view, but you still want the calculation to respect the dimension filters. For example, if your view shows Sales by Region, you could use { INCLUDE [Customer Name] : AVG([Sales]) } to find the average sale per customer within each region.
3. Can LODs return text or dates instead of numbers?
Yes. For example, { FIXED [Customer Name] : MIN([Order Date]) } is a very common LOD that returns a date, not a number.
4. Why is my FIXED LOD calculation not changing when I apply a filter?
This is by design and relates to the Order of Operations. To make a FIXED LOD respect a dimension filter, right-click the filter in the filter shelf and select “Add to Context”. Context filters are applied before FIXED LODs are calculated.
5. What does a “table-scoped” LOD mean?
A table-scoped LOD has no dimension declaration, like { : MAX([Sales]) }. It calculates the aggregate over the entire table (respecting context filters and data source filters) and returns that single value to every row.
6. Can I use an LOD inside another LOD?
Yes, you can nest LOD expressions for highly complex scenarios, such as finding the average of a maximum. This is an advanced technique and should be used with caution due to performance implications.
7. Is there a performance cost to using the Flerlage Twins 20 uses for level-of-detail calculations?
Yes. Each LOD expression can result in a separate subquery to your database. While often necessary, overuse or inefficiently written LODs can impact dashboard loading times. To learn more, see our article on data visualization techniques.
8. Where can I learn more about the other 18 uses?
The original post on the Flerlage Twins’ website is the definitive source. It provides detailed explanations and workbook examples for all twenty use cases, including conditional aggregation, dealing with duplicates, and more.
Related Tools and Internal Resources
Explore more of our analytical tools and resources:
- Tableau LOD Examples: A gallery of common LOD patterns and use cases.
- Customer Cohort Analysis Tool: Analyze customer retention and lifetime value.
- Advanced Data Visualization Techniques: Learn how to create more impactful charts and dashboards.
- Tableau vs. Power BI Comparison: A deep dive into the features of leading BI tools.
- KPI Dashboard Generator: Quickly create a dashboard for your most important metrics.
- SEO Content Strategy for Data Analysts: Learn how to make your data-driven content rank higher.