Forum Discussion

ey_boubellouta's avatar
ey_boubellouta
Regular Visitor
4 years ago
Solved

Modeling slowly changing dimensions

Hello Community,

I ve been working these last days on 3 tables that I want to get insights from (EmployeeAssignment, Person, Department)

the data looks like :

EmloyeeAssignment Table :

AssignmentIdPersonIdDepartmentIdinfovalidFromvalidTo
123info112/01/202115/01/2021
123info215/01/202131/12/4999
235info110/01/202131/12/4999

 

Department Table :

DepartmentIdinfovalidFromvalidTo
1info101/01/202116/01/2021
1info216/01/202131/12/4999
2info112/01/202131/12/4999

 

Person Table :

PersonIdinfovalidFromvalidTo
1info101/01/202116/01/2021
1info216/01/202131/12/4999
2info112/01/202131/12/4999

 

you can see that when the a specific row in the 3 tables changes, we use the SCD2 to keep the history of the records.

I want to be able to model these tables so I can take a snapshot on a date (any specific date) and see the result based on this date. if I create a sort of surrogate key for each table( ex : combine DepartmentId with validfrom), I wown't be able to replace the forreign keys in the table EmployeeAssignment. How can I hundle this situation ?

 

best regards

 

1 Reply