> ## 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, but available on all Omni instances.
</Note>

A composite topic combines existing topics so users can query across them from a single workbook. This guide covers creating one in the model IDE and optionally refining its shared views, dimensions, and measures.

## Requirements

To follow the steps in this guide, you'll need:

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

    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
    * A `shared_views:` list populated with any dimension tables joinable from every included topic, if you enabled auto-detection

    For many use cases, this file is enough — skip to [Save and use the composite topic](#save-and-use). Steps 2–4 cover optional refinements.
  </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. If you enabled auto-detection during creation, Omni populates the list for you. Edit it 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>
      To get the exact `${@topic.view.field}` reference, open a workbook on the composite topic, find the measure you want to reference, click the <Icon icon="ellipsis-vertical" type="solid" /> menu, and select **Modeling > Copy reference**. This copies the fully-resolved reference (for example, `${@orders_topic.orders.total_revenue}`) to your clipboard, which you can then paste directly into the 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:

    * **Fields arrive pre-aggregated.** Each `${@topic.view.field}` is already aggregated by the time the shared measure sees it — every topic runs its own subquery first.
    * **Referenced fields are auto-included.** Any field you reference is added to 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.

    <Warning>
      Write the `sql` as plain math over already-aggregated values — arithmetic, `CASE`, `COALESCE`, `NULLIF`, etc. Each referenced field is already a single aggregated value, so wrapping it in `SUM(...)` or `COUNT(...)` or setting `aggregate_type` re-aggregates over the post-join result, which usually isn't desirable.
    </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.
