Software
Microsoft
Hardware
Network
Policy
Building Time Dimension Hierarchy
Hi,
I am building a cube for my client. The time dimension is a little tricky. The fact table has year/month column (values are like 200509) as a key to my period table(time dimension table). On my time dimension I have year, quarter and month attributes. Now, when I try to build a hierarchy I am getting an error because I can link the hieararchy to the key attribute.
If I try to link the key attribute to year and month together then I have missing data issue, the data returned from cube is not correct.
Any idea how I should fix this issue?
I am using ssas 2008.
Thanks
internet advertising
Solution: Building Time Dimension Hierarchy
In your time dimension (I always call it a "date" dimension, and make a separate "time" dimension with HH MM SS if necessary), you'll want to make the key for the month attribute so that it contains the year, e.g. 200901.
I usually set up my date dimension so it contains:
DateKey int -- contains values like 20090101
DateName varchar() -- contains values like "Jan 1, 2009"
DateSortKey -- contains the same value as the DateKey (except in rows like "unknown", "old", "n/a" which I make 99999999 or whatever in order get them to sort to the bottom)
YearMonthKey int -- contains values like 200901
YearMonthName varchar() -- contains values like "Jan 2009"
YearMonthSortKey -- same note as above on DateSortKey
YearQuarterKey int -- contains values like 2009001 (i usually make this a 7 digit to distinguish it from yearmonth)
YearQuarterName varchar() -- values like "2009 Q1"
YearQuarterSortKey -- same note as above on DateSortKey
YearKey int -- values like 2009
YearSortKey -- same note as above on DateSortKey
Carefully set the attribute keys, names, and sortkeys in the dimension designer.
Optionally you might like to include "yearless" attributes which would sum up or provide sliceability to sets based on the month with no specific year getting involved. If you build these be careful not to include them in the hierarchies based on the date attributes that do include the years. I suppose you could set up these in their own "yearless" hierarchy but I think it could be confusing and perhaps even dangerous to do so. In fact, I'd only *create* these if I really needed to:
MonthKey int -- contains values like 1, 2, ..., 12
MonthName varchar() -- contains values like "January"
QuarterKey int - values like 1, 2, 3, 4
QuarterName varchar() -- "Q1"
If your keys in the fact table don't quite match the format then you can either choose different values to store as the keys (like YearMonthKey) in the dimension or just transform them in the DSV on the fact table.
Join from the fact table to the proper level in the date dimension and at cube design time the dimension usage tab should recognise that you're connecting the fact to the dimension at a granularity higher than the key for the dimension. do not panic, this is fine, and it is common to have cubes designed this way -- for instance actual sales usually join to date at the date grain, but forecasts forecasts or quotas are stored at the month, quarter, or year.
Hope this helps.
Popular Tags
Tags:
2000
2005
analysis
Analysis Services
connection
create
cube
cubes
data
date
datetime
dimension
essbase
EXCEL
Excel 2007
fact
MDX
Microsoft
olap
OLAP cubes
Pivot Table
query
restore
services
SQL
SQL Analysis Services
SQL Server
sql server 2005
SQL Server Analysis Services
SSAS
SSAS 2005
SSAS 2008
SSIS
SSRS
SSRS 2005
statement
table
time
warehouse
Browse All Tags