creation of dimension and fact table through source tables

user2861497 picture user2861497 · Oct 9, 2013 · Viewed 8.3k times · Source

I have imported my flatfiles to SQL Server 2012 and created few tables (source tables). I need to build a cube in SSAS. But I need to make "dimension" and "fact" tables it seems with proper PK/FK relations. Could someone tell me whether I need to do:

  1. create an empty dimABC, dimXYZ tables manually with PK identified?
  2. copy data from source tables (imported above) into this new dimXXX tables through some SQL query?
  3. then create a new factXXX table and copy the required facts(data) from source tables above.

Then I need to use these tables during cube build process.

I appreciate your help in clarifying my steps 1,2,3.

Answer

mmarie picture mmarie · Oct 10, 2013

You're pretty close on your steps. It sounds like you are new to data warehousing? You might want to check out The Kimball Group's Data Warehouse Toolkit or website to ensure you get your dimensions and facts built correctly.

You have your data in "staging" meaning you have imported your raw data into SQL Server. You will need to create dimension tables with surrogate keys (just auto-incremented identity values) and then create fact tables that use these surrogate keys as foreign keys. You could probably do all of this in straight SQL, but this is what SSIS is for. Once you have your facts and dimensions defined and populated, best practice is to create views to use in the DSV for your cube.
Once you have your views populated and in your DSV in SSAS, you will build the dimensions and facts and then relate them in the cube. If you define the relationships in the DSV, the relationships will be mostly populated in the Dimension usage tab for you.