Hi. I have used SQL when coding application for many years, but I have only just come across BIDS 2008 and am having a few problems getting my head round creating my date dimension. I hope someone can prod me in the right direction:-
I have a fact table which contains:-
- Customer_Account
- Product_Code
- Transaction_Date
- Transaction_Value
- Transaction_Quantity
Within this table the primary key is Customer_Account, Product_Code, Transaction_Date. I have ensured that there are no Nulls within any of these fields.
In addition I have created some named calculations within this table in my data source view:-
- Year [=Year(Transaction_Date)]
- Month [=Month(Transaction_Date)]
- Key [=CAST(Year(Transaction_Date) As nvarchar(8)) + '|' + Customer_Account + '|' + Product_Code]
After creating my measures (using Transaction_Value and Transaction_Quantity) I then created a date dimension or type 'Time'. To it I have added my 'Year' calculation and set its type to 'Dates, Calendar, Years'. Next I added 'Month' and set its type to 'Dates, Calendar, MonthOfYear'. Next I added 'Transaction_Date', changed its type to 'Dates, Calendar, Date'. Finally I added 'Key' and set its usage to 'Key'.
I have added my measure and dimension to my cube and built and deployed it. When I click on the browser tab on the cube, drag my year to the column heading, the month to the row heading, and my value into the totals the information populates the 'pivot'. However, I must have done something wrong with the dates dimension, because I don't get figures appearing in every month of every year, which I would definitely expect. What's more, the figures that do appear within the cells are completely incorrect.
Please can someone put me out of my misery and tell me what it is that I have done wrong.
I realise that I could create another table with just the dates in and I guess this would probably solve my problem, but that would mean that someone would have to add new dates into the table eventually, and it seems a bit wasteful if the information is already present in my fact table. Or is this better practice for some reason.
Any guidance would be gratefully received. Many thanks for reading.
Alan Moseley