# Primary Dimension

## Overview

The **Primary Dimension** in ReOrc Views serves as the key identifier that defines the root Cube for the join path. It establishes a structured relationship for combining multiple data sources, ensuring accurate and efficient data retrieval.

### Purpose of the Primary Dimension

* **Defines the Root Cube**: Determines the starting point for joining multiple Cubes within the View.
* **Ensures Consistent Data Relationships**: Helps maintain a structured and logical data flow by guiding how joins are applied across related datasets.
* **Optimizes Query Performance**: Provides a predefined path for data aggregation, reducing unnecessary joins and improving efficiency.
* **Supports Business Logic**: Ensures that the View aligns with reporting needs by structuring data based on the most relevant business entity.

### Impact of Primary Dimension on Query Results

The choice of Primary Dimension can significantly influence the outcome of queries and reports. Below are examples of how it affects results:

#### **Example 1: Customer-Centric vs. Order-Centric View**

* **Primary Dimension: `Customer ID`**
  * The View will group data around customers.
  * Aggregations such as total spend per customer will be calculated at the customer level.
  * A customer with multiple orders will have their data merged, displaying cumulative totals.
  * Order without customers will not be show in this scenario.
* **Primary Dimension: `Order ID`**
  * The View will group data by individual orders.
  * Each order will be treated as a separate record, displaying order-level details.
  * Orders without customer will be available.

#### **Example 2: Sales Data with Different Primary Dimensions**

* **Primary Dimension: `Product ID`**
  * The View will show total sales grouped by product.
  * Metrics like average revenue per product will be straightforward to compute.
* **Primary Dimension: `Region ID`**
  * The View will aggregate sales data based on geographical regions.
  * Queries will focus on regional trends rather than product-level sales.

## Set Primary Dimension

To set primary dimension for a view, mouse over to the dimension that you would like to set as the primary dimension and click on **...**, select **Set as primary dimension**

<figure><img src="https://786945529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFTrGKWnjusKCQj11CkuL%2Fuploads%2Fi0Zf8gL3nX7JLvPVGb8H%2Fimage.png?alt=media&#x26;token=5a19a0ed-c35c-4b86-a71e-c2271ae70d87" alt=""><figcaption></figcaption></figure>
