Some dimensions need to track historical data for a given natural key. This is done by creating multiple records in the dimensional tables with separate surrogate keys for the different versions of the same natural key.
Slowly Changing (SC) is based on Surrogate Keys (SK).
Editing of dimension has 2 steps/parts:
Following is described here:
Slowly Changing Type 2 keeps track of history by adding SCDFromDate and SCDToDate columns. In Addition a definition must include a additional historical column.
To define this:
E.g. definition of slowly changing OrganizationID:
In this sample OrganizationID is set as Slowly Changing Surrogate Key. LegalEntityID is used as historical column.
On save, a process dialog is shown:
Click "Reload" to generate table with from and to date columns. This also includes a full reload of all surrogate key data.
If you browse the Surrogate Key table in the data warehouse database, the result has the following columns:
There are 3 ways to get SK SC data:
To load initial values, define a Wide Dimension Source table. The source can be a regular source for the dimension, or based on distinct values from a fact source table.
E.g. load from Dimension Source:
Here the Wide Dimension Source Table has mapped in Natural Key and Name. The Natural Key will get a Surrogate Key, but no dates from/to or historical attribute values.
To get more initial data we could add more columns to this dimension source if it was available from source.
For Fact Source Tables, you map the natural key and the result source view will contain the SC key. The mapping is done with the available columns and the selected date column (e.g. Transdate), If a new item is found it will be added to the SK SC table.
For P/C Dimension Source Tables, the same applies. Natural key is used and the source view will contain surrogate keys.
In order to use a Surrogate Key with/without Slowly Changing, it must be used as the Key (root) Id. E.g.
Her a source is added. along with some properties.
When this is processed, you can edit this dimension.
Dimension Editing
From the Browse/Modify tab, dimension data can be edited.
For SC dimensions there are some more options:
Editing of Surrogate Keys has following modes
On New and Split, SCDFromDate and SCDEndDate are checked against existing items with same natural key. On Update, check the from/to consistency yourself.
In order to use a Surrogate Key with/without Slowly Changing, it must be used as the Key (root) Id. E.g.
After a source is added. switch to Attributes-tab to edit the attributes.
The Key attribute uses the SKey as Key, the natural key as Value and name/description as Name column.
Check the content under the Relations-tab and add a hierarchy (or more) under the Hierarchies tab.
When this is processed, you can edit this dimension.
Dimension Editing
From the Browse/Modify tab, dimension data can be edited.
For SC dimensions there are some more options:
When a dimension is processed, all items are included by default. To take a snapshot at e.g. given date for use in Planning, Versioned Dimensions can be used.
From the Navigator, right click a Dimension (P/C or Wide), and select New Versioned Dimension. When added and if the original dimension is SC, a date field is shown:
Right click in Navigator to browse result.
There are some limitations to a Versioned Dimension: