# \[LOD\] Comparative sales analysis

**URL:** <https://community.omni.co/t/lod-comparative-sales-analysis/407>\
**Category:** Modeling\
**Tags:** modeling, lod\
**Created:** [October 22, 2025, 9:57pm UTC](https://community.omni.co/t/lod-comparative-sales-analysis/407 "2025-10-22T21:57:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrienb](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.omni.co/adrienb/32/385_2.png) [@adrienb](https://community.omni.co/u/adrienb)\
**Post date:** [October 22, 2025, 9:57pm UTC](https://community.omni.co/t/lod-comparative-sales-analysis/407/1 "2025-10-22T21:57:49Z")

</div>

A comparative sales analysis provides a quick visual way to benchmark or compare metrics across key business dimensions. We would like an output like this, where the Comparison Category serves as the basis against which all other categories are measured:

 ![image](https://canada1.discourse-cdn.com/flex004/uploads/omni/original/1X/7027002d0c7db4784ec1106ca2ac87b166c211ff.png)

## Approach - Use Level of Detail (LOD) fields

1. First, determine what dimension and measure will define your analysis. In this example we use total sales grouped by product category.

2. Next, we need to create a “comparison” category - in other words the category selected by the user against which to benchmark all others. For this step we need to go into the IDE to define a filter-only field (this is the only step that isn’t possible through the UI yet). In the view file, we define a filter field called `comparison category` that will be a single-select dropdown suggesting from the existing categories.

3. Back in the workbook, we can now define a dimension called `Selected Sales` that returns the sale price for only rows of the selected category.

4. We now create a Level of Detail field that sums this `Selected Sales` dimension but excludes the Category. In other words we want the total sales from the selected category to appear in every row, independently of how each row is grouped.

5. Now we can build the final query using these fields:

6. Now we have everything we need to create the graph, using the `Difference from Selected` as our metric driving both the x-axis and the color scale!
