Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Use the surrogate key Expand / Collapse
Author
Message
Posted Monday, November 05, 2012 5:32 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, October 17, 2013 4:44 PM
Points: 193, Visits: 513
Here is the scenario. I have a fact table that looks like the following:

factEmployeeWorkHours
PK ID
LastName
FirstName
Hours

The fact table joins to a dimension table that looks like the following:

dimOrganization
PK ID
EmployeeLastName
EmployeeFirstName
Store
StoreManager
RegionalManager
VP
Region
State

But there is a problem. The Employee can be assigned to more than one store and therefore can have more than one store manager, region, etc. If I join the fact table to the dim table during ETL to get the surrogate key/PK from the dim table, I will have multiple PKs per fact table row. I know that Kimball wants to have an FK in the fact table that joins the PK in the dimension table, but is that prudent in this case?
Post #1381327
Posted Monday, November 12, 2012 9:29 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, January 28, 2014 8:15 AM
Points: 3,068, Visits: 4,639
imani_technology (11/5/2012)
Here is the scenario. I have a fact table that looks like the following:

factEmployeeWorkHours
PK ID
LastName
FirstName
Hours

The fact table joins to a dimension table that looks like the following:

dimOrganization
PK ID
EmployeeLastName
EmployeeFirstName
Store
StoreManager
RegionalManager
VP
Region
State

But there is a problem. The Employee can be assigned to more than one store and therefore can have more than one store manager, region, etc. If I join the fact table to the dim table during ETL to get the surrogate key/PK from the dim table, I will have multiple PKs per fact table row. I know that Kimball wants to have an FK in the fact table that joins the PK in the dimension table, but is that prudent in this case?


It all comes down to granularity.

If business requirements call for collecting the employee hours not matter where the employee was working then you shouldn't care about different stores, different managers, etc.

If business requirements call for collecting detailed information about where and with who the employee was working then the design lacks much needed columns to go down to such granularity.

Either way, the design of the fact table (for starters) looks a bit fuzzy to me. Either that fact table expects to have a single row per employee which is the same as saying that the table is not a fact table but a summary table OR, table expects to store as many rows as needed for employee so to track where the employee has worked... in this case having the name of the employee on each row is really not a good idea.

Would you please give more details?


_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Post #1383739
Posted Wednesday, November 21, 2012 11:35 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, April 01, 2014 5:55 PM
Points: 957, Visits: 1,027
imani_technology (11/5/2012)
Here is the scenario. I have a fact table that looks like the following:

factEmployeeWorkHours
PK ID
LastName
FirstName
Hours


Is there a reason why you don't have an employee dimension? That way on your fact table, you could have two dimensions (one for employee, one for store), and employees could work quite happily across multiple stores without it being problematic.

You would end up with a structure on your fact table such as:

factEmployeeWorkHours
PK ID
Employee Dimension Key
Store Dimension Key
Hours


There's a common misconception that dimensional data warehouses are not normalised. While there is some truth in that, it's better to think of them as denormalised in specific cases. In general, fact tables are heavily normalised. That means that if you have repeated sequences within a fact table, the chances are you are missing a dimension.
Post #1387549
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse