Solved

ROLAP date dimension link to OLTP datetime fields in tables

Posted on 2013-06-03
4
735 Views
Last Modified: 2016-02-18
Hi Experts,

Setup:

SQL Server 2008 R2
DBE
SSIS
SSAS

I have created a simple ROLAP database with four tables:

1.DimCustomer
2.DimProducts
3.DimDate
4.FactTable

My DimDate dimension is already populated with date range and the rest of the tables are empty.

Now I want to transfer data from my OLTP database into my ROLAP database. My Date granularity is at the day level.


Now what I am absolutely stumped with is how do I load data from my OLTP database into my ROLAP database with regards to date?

So for example in my OLTP database if I want to load from 2005 -2007. How do I load this data into ROLAP database, so that the ROLAP database knows I'm loading data from 2005-2007 from the OLTP database. So if i run a query in the ROLAP for date range 2005-2007 I will get the same results as OLTP.


I have looked at AdventureWorksDW2008 and I cant figure out how data was loaded from OLTP into ROLAP whilst keeping the date in sync.


Ultimately what I am asking if I am loading data from any source into ROLAP, what actions do I take to match the data dates?

Many Thanks,
j3di
0
Comment
Question by:J3D1-KN1G1-1t
  • 2
  • 2
4 Comments
 

Author Comment

by:J3D1-KN1G1-1t
ID: 39216530
Dont worry I got it, the Fact table has the related OLTP dates....


I will still award though for best answer.
0
 
LVL 37

Accepted Solution

by:
ValentinoV earned 500 total points
ID: 39218286
"I will still award though for best answer."

Understood :)

"Ultimately what I am asking if I am loading data from any source into ROLAP, what actions do I take to match the data dates?"

I would say it depends on the source and on the design of the DimDate.  My ETLs usually use a staging database so the data transition would happen in two phases:

1. load from source into staging - data types are preserved as much as possible
2. load from staging into ROLAP - data types are converted to match ROLAP

It's in the second phase that the fact records need to get matched with the correct dimension records. Usually I use the SSIS Lookup component for that.

Now, DimDate is a special case. In most cases it is a bad idea to put any logic in a primary key but in the case of DimDate it's actually very practical.  Just as they did in AdventureWorksDW, the DateKey is an int with a special structure: YYYYMMDD.

The fact that DimDate is a pre-populated dimension means we know exactly what's in there and what the foreign key in the fact table needs to look like.  Which means we don't need to waste time on a lookup here.

In case your incoming date field is of type datetime (or date), you could fabricate the key using the SSIS Derived Column transform and some math through an expression like:

YEAR(YourDate) * 10000 + MONTH(YourDate) * 100 + DAY(YourDate)
0
 

Author Closing Comment

by:J3D1-KN1G1-1t
ID: 39221594
Thank YOu
0
 
LVL 37

Expert Comment

by:ValentinoV
ID: 39221706
So no further questions on that? Cool! Thank you for accepting my answer! :)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now