Overview
You previously modified the Retailers hierarchy within the cube model. You applied this hierarchy to a cube that you created. The Time hierarchy of the cube model was created from the Time dimension of the GOSALESDW schema. The existing Time hierarchy includes only the Quarter and Day levels. You want to add levels to the Time hierarchy so that you can query at the Year and Month levels also.
When you add levels to your hierarchy, you add levels of granularity. You will be creating this granularity by dividing the Time hierarchy into different levels: Year, Quarter, Month, and Day. You will be able to drill down through this hierarchy and query information from all levels of the cube. For example, you could query all sales of a product that were made by a specific retailer during the first quarter of 2004.
In this lesson, you will modify the Time hierarchy to include Year and Month levels. The steps are similar to the steps that you took when you added the levels to the Retailers hierarchy. However, this lesson will introduce level types, sort order, and composite keys. A level has a composite key when more than one column or attribute is needed to identify a member within the hierarchy. This lesson illustrates how making changes to the cube model affects the cube. This lesson will also show you how you can iteratively refine existing cube models and cubes to make them more useful.
Tasks in this lesson
To modify the Time hierarchy, do these tasks:
The SalesCube cube references the Time dimension of the cube model. The Time dimension currently contains only two levels, Quarter and Day. You will modify the Time dimension to include two new attributes. These attributes will map to information in the GOSALESDW.GO_TIME_DIM table of the GSDB database. You will be able to use these attributes later in this lesson to create new Year and Month levels within your hierarchy.
Procedure
To add attributes to the Time dimension:
A level consists of a set of attributes that work together as one logical step in the ordering of a hierarchy. A level contains one or more attributes, and the level defines the relationship between those attributes. Levels also have a type. You can specify a level type as Unknown, Regular, or Time or Date. MDX provides a number of special time-specific functions. To make these functions available within a hierarchy, you must explicitly set the level time to be Time or Date and choose one of the options.
For each level in a dimension, you must define a level key. A level key consists of one or more level key attributes. Level key attributes should uniquely identify each member in the level.
A composite level key can consist of level attributes from all ancestors of the member, such as CURRENT_YEAR and CURRENT_MONTH. The composite level key will uniquely identify each member in the level. For example, every year has a month "01," so having a level key of just Month does not uniquely identify each member in the Month level. It is the combination of the year and the month that makes a month unique. Therefore the level key, Month is actually two keys: Year and Month.
A composite level key is typically less efficient when compared to a compact level key such as MONTH_KEY. It is recommended that you use compact, single-member level key attributes to improve the efficiency of your cube and cube model.
Procedure
To create the Year and Month levels:
Procedure
To add the Year and Month levels to the Time hierarchy:
If your cube contains errors, a number of these errors will be found by the model analyzer when you validate the cube model.
Procedure
To validate the Sales cube model in the Data Project Explorer: