> For the complete documentation index, see [llms.txt](https://gchandra.gitbook.io/data-warehousing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gchandra.gitbook.io/data-warehousing/data-warehousing-concepts/types-of-dimensions/role-playing-dimension.md).

# Role Playing Dimension

Role-playing dimension is a term used in data warehousing that refers to a dimension used for multiple purposes within the same database. Essentially, the same dimension table is linked to the fact table multiple times, each playing a different role. This concept is often used when a single physical dimension can have different meanings in other contexts.

**Date Dimension**: This is the most common example. A single date dimension table can be used to represent different types of dates in a fact table, such as:

* **Order Date**: The date when an order was placed.
* **Shipping Date**: The date when an order was shipped.
* **Delivery Date**: The date when an order was delivered.

**Employee Dimension in a Hospital Setting**:

* **Attending Physician**: The primary doctor responsible for a patient.
* **Referring Physician**: The doctor who referred the patient to the hospital.
* **Admitting Physician**: The doctor who admitted the patient to the hospital.

**Product Dimension in Retail**:

* **Ordered Product**: The product that a customer ordered.
* **Returned Product**: The product that a customer returned.
* **Replacement Product**: The product was sent as a replacement for a returned item.

#### Why Use Role-Playing Dimensions?

* **Efficiency**: It's efficient in terms of storage as you don't need to create multiple dimension tables for each role.
* **Consistency**: Ensures consistency across different business processes since the same dimension table is used.
* **Flexibility**: Offers flexibility in querying and reporting. You can easily compare and contrast different aspects (like order date vs. delivery date).

<figure><img src="https://2629735788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3G2NQEHaUSzehWzaKvXK%2Fuploads%2F5HpWR9CGNtuZNARxyifd%2Fsales_100_dimension_sample.png?alt=media&amp;token=85cad6e8-582c-4836-a1ed-591b39517574" alt=""><figcaption></figcaption></figure>
