> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Composite topic examples

> Worked composite topics — a complete example, plus orders vs. shipments, a marketing funnel, and a constellation schema with a date spine.

<Note>
  **Composite topics are currently in beta.** Reach out to your Omni contact or Omni support to opt into the beta.
</Note>

A few worked composite topics you can adapt. For the full reference of every parameter, see [Composite topic parameters](/modeling/composite-topics/parameters).

## Complete example

A composite topic using the most common parameters:

```yaml title="Full composite topic example" theme={null}
topics: [orders_topic, marketing_topic]

label: "Orders & Marketing"
description: "Revenue and marketing performance, aligned by date and region"

shared_views: [date_spine, regions]

shared_dimensions:
  activity_date:
    label: "Activity date"
    description: "Date the order was placed or the campaign was active"
    ai_context: "Use this for any time-series comparison between orders and marketing."
    mappings:
      orders_topic:
        field: orders.created_at
      marketing_topic:
        field: campaigns.start_date

  region:
    label: "Region"
    mappings:
      orders_topic:
        field: regions.region_name
      marketing_topic:
        field: regions.region_name

shared_measures:
  revenue_per_dollar_spent:
    label: "Revenue per $ spent"
    sql: ${@orders_topic.orders.total_revenue} / NULLIF(${@marketing_topic.campaigns.total_spend}, 0)
    format: usdcurrency_2

  combined_event_count:
    label: "Total events"
    sql: ${@orders_topic.orders.count} + ${@marketing_topic.campaigns.count}
```

<Note>
  Shared measures take **plain math** over already-aggregated values — arithmetic, `CASE`, `COALESCE`, `NULLIF`, etc. See [shared\_measures](/modeling/composite-topics/parameters/shared-measures) for details.
</Note>

## Orders vs. shipments by week

A classic fan-out scenario: every order has one or more shipments. Joining directly inflates order revenue.

```yaml title="orders_and_shipments.composite_topic" theme={null}
topics: [orders_topic, shipments_topic]
label: "Orders & Shipments"

shared_dimensions:
  week:
    label: "Week"
    mappings:
      orders_topic:
        field: orders.created_at
      shipments_topic:
        field: shipments.shipped_at

shared_measures:
  fulfillment_rate:
    label: "Fulfillment rate"
    sql: ${@shipments_topic.shipments.count} / NULLIF(${@orders_topic.orders.count}, 0)
    format: percent_2
```

Pick **Week**, **Orders → Total revenue**, **Shipments → Shipment count**, and **Fulfillment rate** in a workbook — one row per week, all four columns correctly computed.

## Marketing funnel across systems

Each funnel stage lives in its own topic (separate fact tables in different schemas). The composite topic stitches them together by cohort week.

```yaml title="acquisition_funnel.composite_topic" theme={null}
topics: [signups_topic, trials_topic, conversions_topic, churn_topic]
label: "Acquisition funnel"

shared_dimensions:
  cohort_week:
    label: "Cohort week"
    mappings:
      signups_topic:
        field: signups.signed_up_at
      trials_topic:
        field: trials.started_at
      conversions_topic:
        field: conversions.converted_at
      churn_topic:
        field: churn_events.churned_at

shared_measures:
  trial_to_paid_rate:
    label: "Trial → paid"
    sql: ${@conversions_topic.conversions.count} / NULLIF(${@trials_topic.trials.count}, 0)
    format: percent_2

  net_new_customers:
    label: "Net new customers"
    sql: ${@conversions_topic.conversions.count} - ${@churn_topic.churn_events.count}
```

## Constellation schema with a date spine

When you want to chart multiple fact tables alongside a continuous date axis (no gaps for days with zero activity), use a `date_spine` shared view.

```yaml title="daily_kpis.composite_topic" theme={null}
topics: [orders_topic, support_topic, product_usage_topic]
label: "Daily KPIs"

shared_views: [date_spine]
```

Because `date_spine` is a shared view joined into every topic, every day appears in the result — even days with no orders, no tickets, or no usage events.

## Custom timeframe labels on shared dimensions

When a shared dimension wraps a date or timestamp field, you can customize which timeframes are available and override the display labels for each timeframe:

```yaml title="custom_timeframe_labels.composite_topic" theme={null}
topics: [orders_topic, marketing_topic]
label: "Orders & Marketing"

shared_dimensions:
  activity_date:
    label: "Activity date"
    description: "Date the order was placed or the campaign was active"
    timeframes: [date, week, month, quarter, year]
    timeframe_metadata:
      date:
        label: "Day"
      week:
        label: "Week starting"
      month:
        label: "Month of activity"
      quarter:
        label: "Fiscal quarter"
      year:
        label: "Activity year"
    mappings:
      orders_topic:
        field: orders.created_at
      marketing_topic:
        field: campaigns.start_date
```

The custom labels appear in the field picker when users select the shared dimension, making it clearer which timeframe level they're choosing.
