# A Deeper Look at LOD Expressions—Week 2

In today's post we will continue to discuss Level of Detail (LOD) Expressions. Since it is often easiest to learn through examples, we will showcase some common analytical questions that LOD Expressions solve elegantly. We will start with simple examples and get progressively more complex throughout the series.

Why is this important?

LOD challenges arise everywhere and whether you realize it or not there is a very good chance you have run into them before. LOD Expressions allow us to fix a calculation to a specified dimension so that it will always compute at that level of granularity. You can think of it as a hidden shelf to put dimensions.

Who are LOD Expressions for?

Have you ever asked a seemingly simple question of your data and not been able to find a useful solution? Have you ever found yourself creating a complex workaround to those simple

questions? Then it’s very likely you have experienced an LOD related challenge.

LOD Expressions take Tableau's computational capabilities to the next level and both eliminate the need for many cumbersome workarounds and enable use cases that were previously not possible. After a little bit of practice everyday business users can use LOD Expressions to amplify their ability to see and understand data.

Let’s look at LOD expressions in a few real examples:

**Histogram of Orders**

Finding the number of times each customer made an order from our stores is an easy task. What if we want to know the number of customers who made 1, 2, 3 or 4 purchases in total? This is a simple question, but without LOD Expressions the solution would be difficult. The order data in this example has multiple items per order, therefore we cannot just make a histogram from the count distinct of orders. We need to find a way to always set the distinct count of orders to the customer dimension.

**Daily Profit KPI**

We can certainly view profit trends over time, but what if we measured our success by the total profit per business day? We would probably want to know the number of profitable days achieved each month or year, especially if we were curious about seasonal effects. The following workbook shows how LOD Expressions allow us to easily create bins on aggregated data such as profit per day rather than profit per transaction.

**Comparative Sales**

LOD Expressions open up a world of possibilities for cohorts, aggregates of aggregates, aggregated bins and many more areas. They also open doors to less obvious, but equally

valuable use cases such as comparing a section of our regions/items/employees to all others. The following example walks through how to compare a selected category to all of the other peer categories, which makes it easy to see how they are doing relative to each other.