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

Last updated