> For the complete documentation index, see [llms.txt](https://docs.fabricplan.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fabricplan.com/documentation/readme/powertable-sheets/concepts/type-2-scds.md).

# Slowly changing dimensions

Slowly changing dimensions (SCDs) are used in data warehouses to capture changes in dimensional attributes. Dimensions such as products and customers can change over time. To ensure accurate historical reporting, the data warehouse must capture and maintain these changes.

## Type 2 SCDs

A Type 2 slowly changing dimension (SCD) creates a new record when dimensional data changes and marks the existing record as inactive. This approach preserves historical data by maintaining multiple versions of the same dimension record.

Type 2 slowly changing dimensions (SCD) maintain a history of dimension changes using the following attributes:

* *Surrogate key*: A unique, sequential identifier assigned to each record. For example, a customer may change their residential address multiple times while retaining the same customer ID. When a customer changes their address, a new record with a new surrogate key is inserted while the customer ID remains unchanged, preserving the historical record.
* *Effective dates***:** Start and end dates define the timeframe during which a specific version of the record was active. Effective dates enable point-in-time historical reporting. Old records are closed out by updating their end date.
* *Active flag***:** A boolean (true/false) column to quickly identify the latest record without requiring date filters.

#### How type 2 SCDs work

Consider a type 2 product dimension that captures price fluctuations. The original data is shown.

<figure><img src="/files/vyyHqaRW4Wv0njgSCcuQ" alt=""><figcaption></figcaption></figure>

When the product price changes, a new row is inserted to capture the updated price. The original row is then marked as inactive by setting an end date and updating the active flag.

<figure><img src="/files/3YF15lmYQpk6GgfrTTGI" alt=""><figcaption></figcaption></figure>

## Type 3 SCDs

Type 3 slowly changing dimensions maintain historical changes by keeping both the old and new values of an attribute within the same row. The latest value is updated in the primary column, and the previous value is moved to another column that is used to track changes. Since each change is stored in a new column, Type 3 slowly changing dimensions (SCDs) can maintain only a limited amount of historical data.

#### How type 3 SCDs work

Consider a type 3 product dimension that captures price fluctuations. The original data is shown.

<figure><img src="/files/GPCVXRhkdgOhScbrZ94P" alt=""><figcaption></figcaption></figure>

When the price changes, the new value is captured in the *Price* column and original value is moved to the *PreviousPrice* column.

<figure><img src="/files/569928z6qmTkjkRQ5qky" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fabricplan.com/documentation/readme/powertable-sheets/concepts/type-2-scds.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
