views:

33

answers:

0

I'm trying to make a sales report based on the following:

DColor

IdColor  ColorPalette  ColorName
21       Vibrant       Blue
22       Nature        Brown
23       Vibrant       Red
24       Nature        Black
25       Vibrant       Yellow
...      ...           ...

DFurniture

IdFurniture  FurnitureType  FurnitureName
43           Tables         Round table
46           Chairs         Big chair
...          ...            ...

DTarget

IdTarget  TargetStyle  TargetName
81        Classic      Dark big chair of the kings
82        Classic      Dark round table of the knights
83        Modern       Happy big chair of the CEO
84        Modern       Happy round table of the trade
...       ...          ...

FSales

IdTarget  IdFurniture  IdColor  QuantitySold
81        46           22       14
84        43           21       25
...       ...          ...      ...

So far it's a classic star schema, where the leafs of DTarget are grouping various combinations of colors and furnitures, based on users conventions.

The report must contain all the levels from the DTarget, then all valid levels from DColor for each target, and the quantity where it's present. In order to do that I also have all valid combinations:

Combinations

IdTarget  IdFurniture  IdColor
81        46           22
81        46           24
82        43           24
83        46           21
83        46           25
84        43           21
84        43           23
84        43           25

And so, the final report should look like:

TargetStyle  TargetName                       ColorPalette  ColorName  QuantitySold
Classic      Dark big chair of the kings      Nature        Brown      14
Classic      Dark big chair of the kings      Nature        Black
Classic      Dark round table ok the knights  Nature        Black
Modern       Happy big chair of the CEO       Vibrant       Blue
Modern       Happy big chair of the CEO       Vibrant       Yellow
Modern       Happy round table of the trade   Vibrant       Blue       25
Modern       Happy round table of the trade   Vibrant       Red
Modern       Happy round table of the trade   Vibrant       Yellow
...          ...                              ...           ...        ...

Given that the design of the tables is frozen, one way would be to keep the model as it is, use the Combinations table to construct the DTarget and the DColor part, then outer join with FSales on both IdTarget and IdColor in order to obtain the report.

Is there a better approach? Could anyone recommend a good book/tutorial that covers the modelling of this kind of relations between hierarchies?

Environment: Cognos 8.4 or MS SQL 2005 Analysis Services, in case there are some specific advices.