Thanks for all your responses, let me try to give more information with this response. Its a very straight forward problem actually, simple aggregation tables and a main fact table , let me answer your questions
- From which tables are the dimensions Year, Quarter, Month, Week coming from?
each table has these relevant dimensions required for its aggregation. For ex week table has year qtr month week colmns, month table has year qtr month column, quarter table has year qtr columns and year table has year only column, Ofcourse all tables have the relevant item_key and sales quantity metric column aggregated at the table level
so yr table has the aggregated one row (yr, item, quantity)
2011 ,item1, 30
QTR table wil have the rows (yr,qtr,item,qty)
2011,1,item1,10
2011,2,item1,5
2011,3,item1,15
sum all quarter sales (10+5+15)=30 (for one full year)
and so on and so forth the monthly and weekly tables are expanded…
-
How are these dimension tables joined to your various fact tables?
there is only one main fact table which is fact_sales, and all these are joined by the item_key , I joined all the above tables to the fact table using this item_key. If I keep all these tables as standalone tables how will the join between one of these tables and the main fact table happen, so I need to join atleast the week table to this fact table, is it not ?
-
How have you defined universe contexts?
not yet, I dont think its required, its a simple 1 main fact table (fact_sales) and 1 dim_item table tht has item information and 4 aggregated tables for yr, qtr,mnth,week etc
-
And finally, what does the generated SQL code look like for the various scenarions: Year & Sales fact, Quarter and Sales fact, Month and Sales fact, Week and Sales fact?
The generated SQL says
(note I am running this for one item and one year only)
Select * from fact_table, (select all columns with proper joins)Week
where
week.item_key=fact_table.item_Key (this join came because I joined the weekly table and fact_sales table)
there is only one aggre_variable object created in the universe (defntion I have given in my earlier post) so when I pull this object into the query it automatically includes the above inner “week” table, presumably because week is the lowest granular agreegation possible
Hope this is enough information, do let me know if you have any more questions.
Additionally, how dose the SQL generated look like in such conditions, is it supposed to be similar to the above ? The lowest granular table is chosen so aggreagation can hapen from there, am I right ?
sorrynoparking
(BOB member since 2008-06-04)