I am using the following (simplified) star scheme as the data source for an SSAS OLAP cube:
In my cube, I have measure [Days], which simply contains "1" for each date - this is just a neat way to get the number of days over some period, useful for calculating daily averages, etc. Obviously, this measure is unrelated to both the Shop- and the Employee-dimension.
Now, say for example, I use the following MDX query:
SELECT { [SalesAmount], [Days] } on 0,
{ [Shop].[Shop].[Shop].members } on 1
FROM
[MyCube]
WHERE
( [Shop].[Country].[USA], [Calendar].[Month].&[201406] )
This returns a list of all shops in USA, with their sales amount for June 2014, and the number of days in June. It works as expected and performance is great.
Say now, that I want the same list, but in addition to shops, I want to split the sales amount by employee. Naturally, I cross the Employee-dimension with the Shop-dimension:
SELECT { [SalesAmount], [Days] } on 0,
{ [Shop].[Shop].[Shop].members *
[Employee].[Employee].[Employee].members } on 1
FROM
[MyCube]
WHERE
( [Shop].[Country].[USA], [Calendar].[Month].&[201406] )
There are two issues with this: First of all, performance suffers a lot when crossing these two (potentially) big dimensions. Secondly, I get a lot of records with Sales Amount = NULL
, for all those employees who are not affiliated with shops in the USA. If I remove the [Days] measure, I get the expected result, but I need that measure for daily averages, etc.
I am looking for alternative ways to model my cube, to avoid this problem. That is, when I filter my fact table by the Shop-dimension, I only want relevant records from the Employee-dimension shown (hence the title of this post, since the Employee and Shop dimensions are related through the fact table).
I have considered combining the Shop and Employee dimension into a single "organization" dimension, but this creates multiple problems: First of all, an employee may work in more than one shop, and over time affiliations may change.
Note: I am not looking for an alternative MDX solution, as my end-users use various front-end tools, where they don't have any control over the generated MDX. The problem, as I see it, should be solved in the multidimensional modelling, and not in the front-end. Modelling techniques and references to literature will be very appreciated.