Solved

ROLAP date dimension link to OLTP datetime fields in tables

Posted on 2013-06-03
4
743 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

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…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

751 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