Solved

ROLAP date dimension link to OLTP datetime fields in tables

Posted on 2013-06-03
4
738 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.

809 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