ptg 2054 CHAPTER 51 SQL Server 2008 Analysis Services FIGURE 51.20 Finishing the generation of the time dimension. can see in Figure 51.21, you can click and drag any attribute listed in this dimension from the Attributes pane (on the far left) to the Hierarchies pane. A new hierarchy is created automatically when you pull your first attribute into this work area. Your goal is to create the following hierarchy for the time dimension (in this order, from top to bottom): 1. All Time 2. Year Time 3. Quarter Time 4. Month Time In addition, from this designer, you can click on the Attribute Relationships tab to see how the dimension key relates to any of the other attributes you have defined in the dimension. Usually, there is a correspondence of the key attribute to each of the hierar- chy levels (which show how they can be used). Figure 51.22 shows what was generated by the Dimension Wizard. If you need to specify other attribute relationships, you can easily do so here. If you want to browse the data that will make up your dimension that is coming from the data source, you must first process your dimension (populate the values that represent the dimension and hierarchy). A process icon (the second icon) in the upper-left corner of the dimension structure designer takes you through a two-step process sequence. Step one is to deploy the definitions and see whether any errors might exist. Step two is to populate the values (run the processing). If you like, you can do this now. When this sequence is ptg 2055 An OLAP Requirements Example: CompSales International 51 FIGURE 51.21 Creating the time hierarchy in the dimension designer. FIGURE 51.22 Attribute relationships in your dimension. ptg 2056 CHAPTER 51 SQL Server 2008 Analysis Services done, you should be able to open the Dimension Browser and navigate around in your fully populated dimension hierarchy (as shown in Figure 51.23). You will probably notice that the data values being displayed in the time hierarchy are numeric. These are the key values of each level in the hierarchy. If you want to see the full description of the hierarchy values instead of just the key values, you can easily modify the properties of each hierarchy level column’s NameColumn and ValueColumn properties to have them pull the descriptive (more natural) values from the related table entries. You simply browse down into the property window of any level of the hierarchy and update the values with the corresponding column names of the related table’s description column name. The window at the top of Figure 51.24 shows the top-level column (All Times) column properties with nothing identified in it’s NameColumn or ValueColumn properties (actually (none) is the default). The window at the bottom of Figure 51.24 shows the same properties updated with the corresponding description columns from the corresponding reference table. You can now update each level in the hierarchy in the same way (with the corresponding description column for each time hierarchy level) and then reprocess the dimension. When you reload the dimension in the Dimension Browser, you see the full description values displayed, as shown in Figure 51.25. That’s it! You have just generated your first usable dimension for the cube! If you didn’t have such a well-defined data source set of tables to base your time dimen- sion on, you could use either of the other two kinds of time dimension options within this wizard. As you can see in Figure 51.26, you need to specify the date periods that will be used when generating the hierarchies, along with the corresponding attributes (time table columns). Setting these attributes is relatively standard. FIGURE 51.23 Browsing the time dimension hierarchy. ptg 2057 An OLAP Requirements Example: CompSales International 51 FIGURE 51.24 Updating the NameColumn and ValueColumn properties of a dimension hierarchy. FIGURE 51.25 Full descriptions of hierarchy levels. Figure 51.27 shows the different server time dimension options that Microsoft provides for your convenience. Microsoft has tried to cover the primary variations of time dimensions and calendars in the market: Fiscal, Reporting (for example, for Marketing, which also includes week-by-month patterns such as 4-4-5 calendars), Manufacturing, and even ISO 8601 calendars. The process is to first identify a time period and then select the calendar type to use. The wizard then creates a server time dimension that meets your needs. ptg 2058 CHAPTER 51 SQL Server 2008 Analysis Services FIGURE 51.26 Specifying the time period and hierarchy attributes when not using a data source table. FIGURE 51.27 Calendaring options for server time dimensions in the Dimension Wizard. ptg 2059 An OLAP Requirements Example: CompSales International 51 NOTE You might want to have multiple time dimensions in your cube to fulfill multiple busi- ness unit group needs. You can create as many as you need and then provide perspec- tives of the cube for each group that include only each group’s specific time dimension for its needs. Creating the Other Dimensions Now you essentially need to go through the whole process of creating a dimension and a hierarchy for the other dimensions (Product and Geography). The process is as follows: 1. Invoke the Dimension Wizard (by right-clicking the Dimensions object in the Solution Explorer). 2. Choose the creation method for the dimension to use the existing table from a data source approach. 3. Specify the Comp Sales2008 DSV data source view. 4. Select the main dimension table to use ( Prod_Dimension for the Product dimension and Geo_Dimension for the Geography dimension). 5. Identify the key column of each new dimension ( ProductID for the Product dimen- sion and GeoID for the Geography dimension). 6. Select the related tables. 7. Specify the dimension attributes and the attribute types (regular). 8. Name the dimension ( Product_Dimension and Geography_Dimension) and finish the Dimension Wizard (which places you in the dimension designer). 9. Drag the dimension attributes to the Hierarchies pane to create the dimension hier- archy view: . Use the following product hierarchy, in this order (see Figure 51.28): 1. All Products 2. Product Type 3. Product Line 4. Product Family 5. SKU . Use the following geography hierarchy, in this order (see Figure 51.29): 1. All Geo 2. Maj Geo 3. Country 4. Channel 5. Customer ptg 2060 CHAPTER 51 SQL Server 2008 Analysis Services FIGURE 51.28 Creating the product hierarchy in the dimension designer. FIGURE 51.29 Creating the geography hierarchy in the dimension designer. 10. Update the NameColumn and ValueColumn properties of each dimension hierarchy level. 11. Process the dimension and browse the dimension. Creating the Cube Most of the hard work in the CompSales International example is done. All that is left to do now is to create a cube that is based on your fact tables in your data source, use the dimensions and hierarchies you just defined, and then process it (that is, populate the cube with data). In the Solution Explorer, you right-click the Cubes object and select New Cube. This invokes the Cube Wizard, as shown in Figure 51.30. Next, you identify the measure group tables from the data source view that will be used to provide data to the cube. Available data source views are listed in this dialog. Because you ptg 2061 An OLAP Requirements Example: CompSales International 51 FIGURE 51.30 Selecting the build method for the cube in the Cube Wizard. The wizard detects the possible data measures (facts) from the measure group table you just identified. In this measure group table, there are Sales Units, Sales Prices, Sales Returns, and a Count measure to choose from. Select all of them, as shown in Figure 51.32. If you have dimensions defined already (as you chose to do earlier), you want the new cube to use these definitions. The next wizard dialog lists any shared dimensions that have been created already. Your dimensions are listed there, and you need to check all the ones to be used for your cube ( Time_Dimension, Product_Dimension, and Geography_Dimension), as shown in Figure 51.33. Then you click Next. As you can see in Figure 51.34, the last dialog in this wizard shows a preview of your complete cube definition and provides a place to name the cube (for this example, name it Comp Sales). Now you click Finish. You are now put in the cube designer, which shows the completed cube design for Comp Sales. The cube designer provides all related cube information within the single IDE (Visual Studio). Figure 51.35 shows the cube designer and all related tabs that can be invoked from here (Dimension Usage, Calculations, KPIs, Actions, Partitions, Aggregations, Perspectives, Translations, and the Cube Data Browser). have already defined a data source view ( Comp Sales2008 DSV), you simply highlight it and check the primary fact table (use CompSalesFactoid as your Measure group table) that will provide your data, as shown in Figure 51.31, and click Next. ptg 2062 CHAPTER 51 SQL Server 2008 Analysis Services FIGURE 51.31 Selecting the data source view and measure group table to use for the cube. FIGURE 51.32 Selecting the measures (facts) that will be in the cube. ptg 2063 An OLAP Requirements Example: CompSales International 51 FIGURE 51.33 Selecting the existing dimensions for your cube. FIGURE 51.34 Naming the cube and previewing the cube definition in the Cube Wizard. . select the calendar type to use. The wizard then creates a server time dimension that meets your needs. ptg 2058 CHAPTER 51 SQL Server 2008 Analysis Services FIGURE 51.26 Specifying the time period. dimension designer. FIGURE 51.22 Attribute relationships in your dimension. ptg 2056 CHAPTER 51 SQL Server 2008 Analysis Services done, you should be able to open the Dimension Browser and navigate. descriptions of hierarchy levels. Figure 51.27 shows the different server time dimension options that Microsoft provides for your convenience. Microsoft has tried to cover the primary variations of time