Link to home
Start Free TrialLog in
Avatar of J3D1-KN1G1-1t
J3D1-KN1G1-1t

asked on

How to load OLTP data into Dimension and Fact table

Experts,


I have a Dim Customer table and Dim Products table and a FactSaletable:

Dim Customer Table:

CustomerID     AlternateKey     CustomerName       CustomerCompany
1                      34525                James Boags            Target

Dim Products table:

ProductID       AlternateKey     ProductType        ProductName
1                     345354              Large                   Ball


FactSales table:

ID     CustomerID(FK)    ProductID(FK)      Qty     SalesAmount
1        1                          1                           2       $45


So I have created primary keys for all dimension tables which are foreign keys in the Fact table. Also a primary key for the fact table.

Now how am I suppose to load data into these tables from the OLTP database so items and
customer details are referenced accurately. I dont know how to relate the OLTP data to the fact tables so it references the Dim tables.

Please let me know if you need further details. Any help would be greatly appreciated.


Many Thanks,

J3di
Avatar of Racim BOUDJAKDJI
Racim BOUDJAKDJI
Flag of Algeria image

I dont know how to relate the OLTP data to the fact tables so it references the Dim tables.
You first fill your dimension tables then your fact table using INSERT statement based on selections from your OLTP.   Please make sure you use SELECT DISTINCT to avoid redundant rows.

Hope this helps.
ASKER CERTIFIED SOLUTION
Avatar of Racim BOUDJAKDJI
Racim BOUDJAKDJI
Flag of Algeria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of J3D1-KN1G1-1t
J3D1-KN1G1-1t

ASKER

Thanks Racimo for your responses. I am aware of OLTP design and business processes.

What I really want to know is how does the dimension table know which row to look at in the fact table.

For example the DimCustomer table has a primary key(CustomerID=1) which is the foreign key in the Fact table. The Alternate key is the actual (CustomerID=34525) in the OLTP database.

So lets say I'm loading the DimCustomer table with :

CustomerID     AlternateKey     CustomerName       CustomerCompany
1                      34525                James Boags            Target


How do I relate and load this information into the fact table. I would understand if the primary for the DimCustomer 34525(alternate) and then this is the foreign key in the fact table. So all inserted data from OLTP is matching in relationship of the ROLAP database.

I get lost in ROLAP concept when there is new customerID in the DIM table and the OLTP key becomes the alternate key.

So I guess If you could please explain the concept or give an example I could better understand.

Many Thanks
After researching I came up with this. Please let me know if it correct.

If I'm loading measures from the OLTP source into Factable. I would have to

1. Lookup the primary key of DimTable by referencing the alternate key with the ID from source DB

2. Add the DimTable Primary KeyID in the fact table and then add then add the measure in.

3. Which means I would have a view or table setup in the the OLTP(with multiple joins) showing Dim and Measure information in a single row. (this would be my source)