> ## 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.

# Create a composite topic

> Create a composite topic in the model IDE, then refine its shared views, dimensions, and measures.

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

## Requirements

To follow this guide, you'll need:

* Composite topics enabled on your instance. To opt into the beta, reach out to your Omni contact or Omni support.
* At least **Modeler** permissions to create a composite topic in the shared model
* At least **two existing topics** that share at least one logical dimension (date, customer ID, region, etc.)

## Create the composite topic

<Steps>
  <Step title="Create the file" id="create-file" titleSize="h3">
    Composite topics live in their own file with the `.composite_topic` extension.

    For many use cases, the create flow alone is enough — save the file and skip to [Save and use the composite topic](#save-and-use). The remaining steps cover optional refinements.

    1. Open the **Model IDE**.
    2. Click File > **New Composite topic**.
    3. Enter a name. This becomes the filename and the unique identifier — for example, `revenue_and_spend`.
    4. Pick the topics you want to combine.
    5. **Optional**. Choose whether Omni should auto-detect shared views across the topics.
    6. **Optional**. Add a **Group Label**.
    7. Click **Create**.

    Omni creates a `<name>.composite_topic` file with:

    * The `topics:` list you picked
    * **Optional**. A `shared_views:` list auto-populated with any dimension tables that are joinable from every included topic
  </Step>

  <Step title="Optional: Refine shared views" id="refine-shared-views" titleSize="h3">
    A **shared view** is a dimension table joinable from every topic — typically a date spine, region table, or product catalog. Omni auto-detects them on file creation; edit the list as needed:

    ```yaml title="Refining shared_views" theme={null}
    topics: [orders_topic, marketing_topic]
    shared_views: [date_spine, regions]   # auto-detected; remove or add as needed
    ```

    Each shared view must be **joinable from every included topic** — either as the base view of every topic or through the model's relationships. The validator surfaces an error otherwise.

    Any topic can use a shared view's dimensions as join keys. Measures on a shared view are aggregated **per topic**, not combined — for example, if both an orders topic and a marketing topic use a shared `regions` view, the field picker shows a separate region count for each topic instead of one shared total.
  </Step>

  <Step title="Optional: Add shared dimensions" id="add-shared-dimensions" titleSize="h3">
    **Shared dimensions** handle the case where each topic has its own field for the same logical concept but at a different path.

    <Note>
      You don't need a shared dimension for a field that already lives in a shared view — the shared view's columns are usable as join keys directly.
    </Note>

    To define shared dimensions, use the `mappings:` syntax — each topic name is a key, and each value is the field path within that topic:

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

    shared_dimensions:
      activity_date:
        label: "Activity date"
        description: "Aligns orders and marketing activity by day"
        mappings:
          orders_topic:
            field: orders.created_at
          marketing_topic:
            field: campaigns.start_date
    ```

    The shared dimension `activity_date` becomes a single selectable field in the workbook. When a user picks it, Omni includes `orders.created_at` in the orders subquery and `campaigns.start_date` in the marketing subquery, then joins on the resulting columns.
  </Step>

  <Step title="Optional: Add shared measures" id="add-shared-measures" titleSize="h3">
    A **shared measure** combines values from multiple topics in a single SQL expression. Define it in the `shared_measures:` block and reference topic-scoped fields with `${@topic_name.view.field}`.

    <Tip>
      **Get the exact `${@topic.view.field}` reference from the field picker.** Open a workbook on the composite topic, find the measure you want to reference, click the <Icon icon="ellipsis-vertical" type="solid" /> menu, and choose **Modeling > Copy reference**. Omni copies the fully-resolved reference (for example, `${@orders_topic.orders.total_revenue}`) to your clipboard — paste it directly into your shared measure SQL.

      <img src="https://mintcdn.com/omni-e7402367/j4gNFqmOh5FevPTi/modeling/composite-topics/images/composite-topic-copy-measure-reference.png?fit=max&auto=format&n=j4gNFqmOh5FevPTi&q=85&s=9aff1935f61e6b55c50aa2c028d36085" alt="The field picker context menu showing Modeling > Copy reference highlighted" data-og-width="411" width="411" data-og-height="298" height="298" data-path="modeling/composite-topics/images/composite-topic-copy-measure-reference.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/omni-e7402367/j4gNFqmOh5FevPTi/modeling/composite-topics/images/composite-topic-copy-measure-reference.png?w=280&fit=max&auto=format&n=j4gNFqmOh5FevPTi&q=85&s=a714038cfbfbffeb419b656ff2a9c61b 280w, https://mintcdn.com/omni-e7402367/j4gNFqmOh5FevPTi/modeling/composite-topics/images/composite-topic-copy-measure-reference.png?w=560&fit=max&auto=format&n=j4gNFqmOh5FevPTi&q=85&s=4ac824730545a046f2a8edc14e497764 560w, https://mintcdn.com/omni-e7402367/j4gNFqmOh5FevPTi/modeling/composite-topics/images/composite-topic-copy-measure-reference.png?w=840&fit=max&auto=format&n=j4gNFqmOh5FevPTi&q=85&s=566e58d97ae374101cd7e3d135fd309b 840w, https://mintcdn.com/omni-e7402367/j4gNFqmOh5FevPTi/modeling/composite-topics/images/composite-topic-copy-measure-reference.png?w=1100&fit=max&auto=format&n=j4gNFqmOh5FevPTi&q=85&s=c7757d6159de140a0028a46012426cc9 1100w, https://mintcdn.com/omni-e7402367/j4gNFqmOh5FevPTi/modeling/composite-topics/images/composite-topic-copy-measure-reference.png?w=1650&fit=max&auto=format&n=j4gNFqmOh5FevPTi&q=85&s=113e1771486472d3b658b062b814dc76 1650w, https://mintcdn.com/omni-e7402367/j4gNFqmOh5FevPTi/modeling/composite-topics/images/composite-topic-copy-measure-reference.png?w=2500&fit=max&auto=format&n=j4gNFqmOh5FevPTi&q=85&s=858d9700a5e3b1644c46867ef9f0c953 2500w" />
    </Tip>

    ```yaml title="Adding a shared measure" theme={null}
    topics: [orders_topic, marketing_topic]

    shared_dimensions:
      activity_date:
        label: "Activity date"
        mappings:
          orders_topic:
            field: orders.created_at
          marketing_topic:
            field: campaigns.start_date

    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
    ```

    A few important things about shared measures:

    * Each `${@topic.view.field}` is **already aggregated** by the time the shared measure sees it — every topic runs its own subquery first.
    * Any field you reference is **auto-included** in the right subquery. You don't need to also add it to the workbook.
    * **Filters on a shared measure run after the join.** For example, `revenue_per_dollar_spent > 1.5` is applied as a `WHERE` on the joined result in the generated SQL.
    * **Write the `sql:` as plain math, not as a re-aggregation.** Combine the per-topic values with arithmetic, `CASE`, `COALESCE`, `NULLIF`, etc.

    <Warning>
      **Write shared measures as plain math, not re-aggregations.** Each topic-scoped field is already a single aggregated value by the time the shared measure runs. Wrapping one in `SUM(...)` or `COUNT(...)` — or setting `aggregate_type:` — re-aggregates over the post-join result, which usually isn't what you want.
    </Warning>
  </Step>

  <Step title="Save and use the composite topic" id="save-and-use" titleSize="h3">
    Save the file. The composite topic appears in the topic picker for any workbook on the same model — open a workbook, select the composite topic, and mix fields from any of the included topics in a single query.
  </Step>
</Steps>

## Next steps

* [Composite topic examples](/modeling/composite-topics/examples) — worked composite topics you can adapt.
* [Composite topic parameters](/modeling/composite-topics/parameters) — the full parameter reference.
