I have a Quarter Dimension Table joined to a Fact Table . Irrespective of what the quarter user selects in the prompt and whether there is data in fact table for that quarter or not , I need to display all the Four quarters of the year in the table( with zero values if data is not there) . How can I design this in universe . The Database envirorment is SQL server and BO version is BOXI R2 .
For eg. Lets consider the Efashion universe and its three tables. Shop_facts, Article_lookup and Calender_Year_lookup. I need to display in the report Shop_facts.Quantity_Sold for one particular item for the next 12 quarters for the year selected irrespective of whether I have data or no data in the sales table
for e.g. in the prompt if I had selected 2004 and Item as SWEATERS then the output should be :
Provided that your quarters exist in a calendar table somewhere, create two data providers in the report. One DP is just to return all years/quarters. The second DP returns the data you actually want, plus years/quarters. Then merge the year/quarter dimensions and display the merged dimenions for year/quarter on the report.
I created an outer join between Calender table and Fact table but its not working. I tried with left outer join and also right outer join. It only displays the combination which is having data. Anybody who can try this out and give a step by step guidance will be much appreciated.
Thanks.
This is the code generated for me . We are using SQL Server Database. Did you create an alias and used outer join on that or directly created an outer join on Calender table with Fact table ? Please could you let me know the SQL generated.
Select DIM_QUARTER.QUARTER_YYYYQQ,FACT_INW_PREMIUM_QUARTER.DIM_SYNDICATE_KEY,
FACT_INW_PREMIUM_QUARTER.DIM_UNDERWRITING_DIVISION_KEY,
FACT_INW_PREMIUM_QUARTER.DIM_DURG_CLASS_KEY,FACT_INW_PREMIUM_QUARTER.DIM_CURRENCY_KEY,
FACT_INW_PREMIUM_QUARTER.DIM_YEAR_OF_ACCOUNT_KEY,
FACT_INW_PREMIUM_QUARTER.DIM_QUARTER_KEY,EARNED_PURE_PREMIUM FROM
FACT_INW_PREMIUM_QUARTER
LEFT OUTER JOIN DIM_QUARTER ON
DIM_QUARTER.DIM_QUARTER_KEY=FACT_INW_PREMIUM_QUARTER.DIM_QUARTER_KEY,
DIM_SYNDICATE,DIM_UNDERWRITING_DIVISION UNDERWRITING_DIVISION,DIM_DURG_CLASS DURG_CLASS, DIM_CURRENCY CURRENCY
WHERE
DIM_QUARTER.YEAR_YYYY IN ( ‘2008’ ) AND CURRENCY.DIM_CURRENCY_KEY=FACT_INW_PREMIUM_QUARTER.DIM_CURRENCY_KEY
AND
DIM_SYNDICATE.DIM_SYNDICATE_KEY=FACT_INW_PREMIUM_QUARTER.DIM_SYNDICATE_KEY
AND
UNDERWRITING_DIVISION.DIM_UNDERWRITING_DIVISION_KEY
For the Given code to work, you need an outer join to all other dimensions as well.
SELECT DIM_QUARTER.QUARTER_YYYYQQ,
FACT_INW_PREMIUM_QUARTER.DIM_SYNDICATE_KEY,
FACT_INW_PREMIUM_QUARTER.DIM_UNDERWRITING_DIVISION_KEY,
FACT_INW_PREMIUM_QUARTER.DIM_DURG_CLASS_KEY,
FACT_INW_PREMIUM_QUARTER.DIM_CURRENCY_KEY,
FACT_INW_PREMIUM_QUARTER.DIM_YEAR_OF_ACCOUNT_KEY,
FACT_INW_PREMIUM_QUARTER.DIM_QUARTER_KEY,
EARNED_PURE_PREMIUM
FROM
FACT_INW_PREMIUM_QUARTER
LEFT OUTER JOIN DIM_QUARTER
ON DIM_QUARTER.DIM_QUARTER_KEY=FACT_INW_PREMIUM_QUARTER.DIM_QUARTER_KEY
LEFT OUTER JOIN DIM_SYNDICATE
ON DIM_SYNDICATE.DIM_SYNDICATE_KEY=FACT_INW_PREMIUM_QUARTER.DIM_SYNDICATE_KEY
LEFT OUTER JOIN DIM_UNDERWRITING_DIVISION UNDERWRITING_DIVISION
ON UNDERWRITING_DIVISION.DIM_UNDERWRITING_DIVISION_KEY = ...
, DIM_DURG_CLASS DURG_CLASS
, DIM_CURRENCY CURRENCY
WHERE
DIM_QUARTER.YEAR_YYYY IN ( '2008' )
AND ...