# \[LOD\] Do longer tenured customers make a larger contribution to sales

**URL:** <https://community.omni.co/t/lod-do-longer-tenured-customers-make-a-larger-contribution-to-sales/389>\
**Category:** Modeling\
**Tags:** modeling, lod\
**Created:** [September 8, 2025, 9:27am UTC](https://community.omni.co/t/lod-do-longer-tenured-customers-make-a-larger-contribution-to-sales/389 "2025-09-08T09:27:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![conor](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.omni.co/conor/32/45_2.png) [@conor](https://community.omni.co/u/conor)\
**Post date:** [September 8, 2025, 9:27am UTC](https://community.omni.co/t/lod-do-longer-tenured-customers-make-a-larger-contribution-to-sales/389/1 "2025-09-08T09:27:14Z")

</div>

## Business Question

For cohort analysis, people often ask about their business is _ **“do longer tenured customers make a larger contribution to sales?”** _

We can group each user by their first order year and breakdown sales each year this way.

## Method 1: Using Level of Detail (LOD) Fields

To calculate the first order date per customer we’ll calculate the minimum Order Date per `User ID` . We’ll use a Level of Detail (LOD) expression in Omni to calculate the minimum Order Date over `Fixed` dimensions of `User ID`.

1. To calculate a level of detail field through the workbook, go the the Order `Created At` dimension → `three dots` → `Modeling` → `New level of detail field`. ![Screenshot 2025-09-08 at 09.51.34](https://canada1.discourse-cdn.com/flex004/uploads/omni/original/1X/b5ee21761b61c71fd00f3017c32cdf9c7c42f3af.png)
2. This will open the UI dialog on the left hand side of the field picker.

 ![Configuring the LOD field to get the minimum Order Date over the Fixed dimension set of User ID.](https://canada1.discourse-cdn.com/flex004/uploads/omni/original/1X/ff6b7a22e4c9abef596f9e0bab4fc9c1203f9a9e.png)

In the model this will be represented in YAML as. We can have as many timeframes as we like which get auto-generated when selected through the workbook.

```yaml

  created_at_date__level_of_detail:
    sql: ${omni_dbt_ecomm__order_items.created_at[date]}
    label: Users First Order Date
    description: Timestamp when the order was created
    group_label: Users First Order
    timeframes: [raw, date, week, month, fiscal_quarter, fiscal_year, year]
    group_by:
      aggregate_type: min # Gets the earliest date per user
      fixed: [omni_dbt_ecomm__users.id] # Groups by individual users

```

1. This new dimension will show the user’s first purchase date on every row of the orders table when selected.

2. Visualizing this as a stacked bar chart and a stacked 100% bar chart to show the growth of sales overtime along the the weightings of the cohorts over time.

 ![Visualizing the stacked bar charts and stacked bar charts 100%.](https://canada1.discourse-cdn.com/flex004/uploads/omni/original/1X/7eb2e659c1eae02e64bbd04c9786efdc9ce2baaf.png)

### Method 2: Query View Approach

Another pattern we could have used here, if we didn’t want to use LOD functions. We could have created a query view grouped by user\_id, min( order date). Omni would created a relationship with this table back to the Orders table and it can be used in analyses and added to topics.
