We have two facts and a shared calendar dimension.
Granularity is defined as follows for the fact tables:
ActualSales: YearID, MonthID, ASales
ForecastSales: YearID, FSales
The calendar dimension is defined as follows:
Years table (Years) fields:
YearID
Months table (Months) fields:
YearID
MonthID
MonthDescription
(please note that MonthID contains values in the form 1, 2…12 instead of 200301, 200302…)
We have two different contexts defined, one for each fact table.
“Actual” context:
ActualSales.YearID=Months.YearID
ActualSales.MonthID=Months.MonthID
Months.YearID=Years.YearID
“Forecast” context:
ForecastSales.YearID=Years.YearID
And, finally, there are 4 objects defined:
Year: Years.YearID
Month: Months.MonthID
ActualSales: ActualSales.ASales
ForecastSales: ForecastSales.FSales
Almost everything works OK, the user can request any dimension or measure and contexts take care of the joins so there’s no cartesian product. BO takes care of the number of queries as well, and synchronizes the results, so year works as a shared level of the calendar dimension, while month doesn’t. Filters in the form year=prompt or month in () work OK as well, Year is filtered in both contexts while Month is only filtered in Actual context.
Our problem: a time range condition. While is possible to define it at the report level, it appears quite difficult for the user:
Things get even more complicated when trying to extend this model to a Year-month-day calendar dimension.
What if we define a condition at the universe level, so the user doesn’t have to learn this logic? Answer: contexts are not applied.
We define the condition as follows:
When the user queries both facts/contexts at the same time:
Year, Month, ActualSales, ForecastSales
With these answers to the prompts:
The condition is aplied only to the first context, so no filter for year is performed in Forecast context! Results include ForecastSales for all years, including year 2004!
2002
Month Sales Forecastsales
11 12121 120
2003
Month Sales Forecastsales
1 123 240
5 232
2004
Month Sales Forecastsales
300
The same condition at document level works fine!
2002
Month Sales Forecastsales
11 12121 120
2003
Month Sales Forecastsales
1 123 240
5 232
This is a simplified example, our universe contains 12 contexts and 4 different granularities regarding the calendar dimension (down to the hour level). So a shared calendar dimension is highly desirable. We would also like to avoid breaking the universe (one universe for each one of the 4 time granularities), as this will bring the need to manually link the shared dimensions at the report level.
We have searched the forum for “calendar table”, “calendar tables”, “time dimension”, etc. to no avail. We’ve also tried AggregateAware solutions, definition of a MonthID as Year||Month, aliases only for filters, only one calendar table with a DateID…
But we think that this is such a common problem that there must be some kind of “by the book” solution.
Thanks in advance for your time and the light you may shed.
puxtarri (BOB member since 2004-06-22)