Tableau LOD (Level of Detail) Expression is one of the most powerful tools to achieve amazing results in building dashboards. In this series of blogs, we will walk through 15 different use cases to demonstrate the usage of LOD expression.
Since this is a series blogs, please use the navigation below to jump to the one you need quickly:
Customer order frequency
When performing sales analysis, we may want to know how many customers only have only placed one order, and how many placed two, etc. So in this example, we could achieve this goal with Tableau LOD expressions.
- Connect to data source: in this example, we just use “Sample-Superstore” dataset from “Saved Data Sources”.
2. Define variable to show order number for each customer: let’s create a calculated field called “Customer Order Number” with a LOD expression shown as below image. After created, “Customer Order Number” shows in measure section by default.
3. Convert created field to dimension: in order to analyze customer number for each order number placed, we need to drag the field to dimension section.
After that we can see “Customer Order Number” becomes a dimension.
For now, when we drag “Customer Order Number” to rows, we can get a list of order numbers as shown in below image:
4. Create distribution: now let’s right click “Customer Name” field and drag to “Columns” and select count distinct and we can get a viz shown below:
It is pretty close, but we still want a little improvement by swap the rows and columns. We could get a shape shown as below:
Now we get the distribution we have.
I also upload a example to Tableau public for reference, hope my blog helps a little bit.