BuyRep 50% for 2003
PlanRep 25%
GenRep 25%
Lets say our customer is Ford Motor. So from Jan to May they had reps 1,2,3 after that they had 4,2,3. At some point you need to join this to a fact table at a monthly level or granularity. Reps 1,2 have always been a part of the New York team. Rep 3 switched from NY to the LA team. Rep 4 has always been in the LA team.
Code: Select all
SalesTeam
Rep Team StartYearMonth EndYearMonth SalesTeamNo
1 NY 200101 Null 111
2 NY 200301 Null 111
3 NY 200202 200306 111
3 LA 200307 Null 111
4 LA 200101 Null 111
RepTeam
Cust Rep StartYearMonth EndYearMonth RepTeamNo RepType
Ford 1 200301 200305 321 Buy
Ford 4 200306 200312 321 Buy
Ford 2 200301 200312 321 Plan
Ford 3 200301 200312 321 Gen
How would you combine all this to a single dimension table? How would you look this key up as the fact loads?
I will post our solution in a few days. Basically you have a between join. They are super slow. There are 100,000 rows in each source table so the combination is in the millions.
