1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu Module 5: Using Advanced Dimension Settings doc

64 249 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Using Advanced Dimension Settings
Trường học Microsoft Corporation
Chuyên ngành Advanced Dimension Settings
Thể loại tài liệu
Năm xuất bản 2000
Thành phố Redmond
Định dạng
Số trang 64
Dung lượng 0,98 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Contents Overview 1 Working with Levels and Hierarchies 2 Working with Time Dimensions 10 Lab A: Creating Time Dimensions 18 Lab B: Creating Hierarchies from Single Columns 22 Lab

Trang 1

Contents

Overview 1

Working with Levels and Hierarchies 2

Working with Time Dimensions 10

Lab A: Creating Time Dimensions 18

Lab B: Creating Hierarchies from Single

Columns 22

Lab C: Creating a Custom Rollup 34

Introducing Member Properties 37

Lab D: Creating Member Properties 42

Understanding Virtual Dimensions 44

Lab E: Creating Virtual Dimensions 50

Review 54

Module 5: Using Advanced Dimension Settings

Trang 2

to represent any real individual, company, product, or event, unless otherwise noted Complying with all applicable copyright laws is the responsibility of the user No part of this document may

be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Microsoft Corporation If, however, the only means of access is electronic, permission to print one copy is hereby granted

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property

 2000 Microsoft Corporation All rights reserved

Microsoft, BackOffice, MS-DOS, Windows, Windows NT, <plus other appropriate product

names or titles Replace this example list with list of trademarks provided by copy editor Microsoft is listed first, followed by all other Microsoft trademarks in alphabetical order > are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A and/or other countries

<This is where mention of specific, contractually obligated to, third party trademarks, which are added by the Copy Editor>

The names of companies, products, people, characters, and/or data mentioned herein are fictitious and are in no way intended to represent any real individual, company, product, or event, unless otherwise noted

Other product and company names mentioned herein may be the trademarks of their respective owners

Trang 3

Instructor Notes

There are several types of dimensions that can be created by using Microsoft®

SQL Server™ 2000 Analysis Services In this module, you lead students through

a solutions-oriented discussion of various advanced dimension settings and methods used to develop online analytical processing (OLAP) dimensions and cubes This module contains labs that give students hands-on experience with various types of real-world dimensions

After completing this module, students will be able to:

! Work with dimension levels and hierarchies

! Understand and work with time dimensions

! Create custom rollup dimensions

! Define member properties at dimension levels

! Create virtual dimensions from member properties and member levels

Materials and Preparation

This section lists the required materials and preparation tasks that you need to teach this module

Required Materials

To teach this module, you need Microsoft PowerPoint® file2074A_05.ppt

Preparation Tasks

To prepare for this module, you should:

! Read all the student materials

! Read the instructor notes and margin notes

! Complete the demonstration

! Practice the lecture presentation and demonstration

! Complete the labs

! Review the Trainer Preparation presentation for this module on the Trainer Materials compact disc

! Review any relevant white papers that are located on the Trainer Materials compact disc

Presentation:

50 Minutes

Labs:

70 Minutes

Trang 4

Demonstration: Creating Virtual Dimensions

To place a virtual dimension in a cube, you must perform the following tasks:

1 Create the source member property, if the virtual dimension is based on a member property

2 Create a new virtual dimension

3 Add the virtual dimension to the cube

4 Process the cube

The following demonstration procedures provide information that will not fit in the margin notes or is not appropriate for student notes

1 In Analysis Manager, right-click the server, click Restore Database, click the Look in list, click the file C:\Moc\2074A\Labfiles\L05\Module

05.CAB, click Open, and then click Restore

2 After the database successfully restores, click Close

3 Double-click Module 05 to expand the database

4 Below Module 05, double-click Data Sources, right-click the Module 05 data source, and then click Edit

5 Click the Connection tab of the Data Link Properties dialog box, and then verify that localhost is selected in step 1

6 In step 2, click Use Windows NT Integrated security

7 In step 3, click Module 05 from the Select the database on the server list

8 Click Test Connection and verify that the test succeeded, click OK, and then click OK to close the Data Link Properties dialog box

1 In Analysis Manager, expand the Module 05 database, expand the Shared

Dimensions folder, right-click Customers, and then click Edit

2 In the Schema pane, right-click the Customer table, and then click Browse

Data

3 Notice the gender column You will create a new virtual dimension based

on gender, because users need to see customer by gender in their reports

4 Close the Browse Data window

5 Double-click the Name level, right-click the Member properties folder, and then click New Member Property

6 Click gender under the Customer table, and then click OK

7 Click the Data tab, expand the Customers dimension to the lowest level,

and then click on a few leaf members to show the member property values

in the Member properties pane

8 Click Save, and then close the Dimension Editor

Demonstration:

10 Minutes

Trang 5

! To create a new virtual dimension

1 In the Module 05 database, right-click the Shared Dimensions folder, point

to New Dimension, and then click Wizard

2 Click Next, click Virtual Dimension, and then click Next

3 In the Available Dimensions pane, click Customers, notice Name.Gender

in the Member properties pane, and then click Next

4 In the Available member properties pane, double-click Name.Gender, and then click Next twice

5 Type Gender in the Dimension name box, and then click Finish to open

the Dimension Editor

6 Close the Dimension Editor

1 In the Module 05 database, right-click the Cubes folder, point to New

Cube, click Wizard, and then click Next

2 Click the custfact table, and then click Next

3 Double-click store_sales and store_cost, and then click Next

4 Double-click Customers, CustTime, and Gender, and then click Next

5 Click Yes when the dialog asks to count fact table records

6 Type Gender Cube in the Cube name box, and then click Finish

1 In the Cube Editor, click the Tools menu, click Process Cube, and then click No to process the cube without designing aggregations

2 In the Process a Cube dialog box, click OK

3 When the cube is finished processing, click Close

4 Click the Data tab to browse the cube

5 Pivot the Customers dimension so that it becomes the column dimension and pivot the Gender dimension so that it becomes the row dimension

6 Click Save, and then close the Cube Editor

Trang 6

Other Activities

Difficult Questions

Below are difficult questions that students may ask you during the delivery of this module and answers to the questions These materials delve into subjects that are within the scope of the module but are not specifically addressed in the content of the student notes

1 Why do you need to disable the counting of members when creating dimensions?

Some dimensions are so large that Analysis Manager cannot successfully count the members at all the levels Analysis Manager can close down while attempting to count millions of members Therefore,

in some instances you need to manually enter the member counts due to the technical restriction in Analysis Manager when working with extremely large dimensions

2 How do front-end applications display dimensions containing multiple hierarchies?

The front-end applications that developers use most often to browse cubes, namely Microsoft Excel 2000 and the Cube Browser, do not display multiple hierarchies in the same way that most third-party applications display them Excel 2000 and the Cube Browser treat each hierarchy as a separate, independent dimension However, most third- party applications direct the user to select one hierarchy per dimension

at any one time to browse cube data Therefore, the users never view multiple hierarchies together on the same report

3 How much detail do you typically define in a Time dimension?

All Time dimensions vary in the level of detail that they store OLAP systems tend to store data at a more summarized level than operational systems Therefore, a common hierarchical structure in Time

dimensions includes Year, Quarter, and Month However, many companies track daily sales in OLAP cubes and therefore store data down to the Day level Manufacturing systems exist that define Time down to the Minute level The levels defined in a Time dimension depend on the reporting and processing requirements of the cube

4 How slow are queries that use virtual dimensions?

Query performance depends on a variety of factors, including cube complexity, the number of members in a virtual dimension, the amount

of data accessed by the query, and even network traffic Therefore, you must test the performance of queries that incorporate virtual

dimensions to ensure that the response times are not excessively slow Virtual dimensions in Analysis Services have improved since their initial release in SQL Server [version 7.0] OLAP Services Nevertheless, you should always test performance before releasing cubes to users

Trang 7

Module Strategy

Use the following strategy to present this module:

! Working with Levels and Hierarchies Explain the importance of levels in the hierarchical structure of a dimension Define the various level settings and describe how these settings enhance levels and hierarchies Define the hierarchies and describe how to create multiple hierarchies in a single dimension Describe the ways to create grouping levels in dimensions containing large amounts of members

! Working with Time Dimensions Explain the importance of Time dimensions in OLAP cubes Describe the characteristics of Time dimensions and explain how to create them Discuss various Time dimension properties and why they are used Explain what a fiscal date hierarchy is and when it used Finally, describe how to use a string to define a Time dimension

! Creating Custom Rollups Define custom rollups and describe how they are used to model hierarchical calculations in dimensions Introduce the use of unary operators, and describe the different operators and their behaviors Finish the section by describing how to employ custom rollups in a dimension and the restrictions related to creating them in cubes

! Introducing Member Properties Introduce the use of member properties in dimensions Describe the characteristics of member properties and explain the steps of creating and previewing a new member property

! Understanding Virtual Cube Dimensions Begin the section by defining virtual dimensions Explain when they are used and how they are created Compare virtual dimensions to regular dimensions and discuss when each type of dimension should be used

Trang 9

Overview

! Working with Levels and Hierarchies

! Working with Time Dimensions

! Creating Custom Rollups

! Introducing Member Properties

! Understanding Virtual Dimensions

There are several types of dimensions that can be created by using Microsoft®

SQL Server™ 2000 Analysis Services This module consists of a oriented discussion of various advanced dimension settings and methods used

solutions-to develop online analytical processing (OLAP) dimensions and cubes This module contains labs that give you hands-on experience with various types of real-world dimensions

After completing this module, you will be able to:

! Work with dimension levels and hierarchies

! Understand and work with time dimensions

! Create custom rollup dimensions

! Define member properties at dimension levels

! Create virtual dimensions from member properties and member levels

In this module, you will learn

about advanced dimension

types and settings

Trang 10

# Working with Levels and Hierarchies

! Applying Level Settings

! Defining a Hierarchy

! Creating Multiple Hierarchies

! Grouping Members into Levels

Creating levels in dimensions establishes the hierarchical structure of dimensions Levels exist in each dimension and determine the detail and summary data stored in cubes In this section, you will learn about the following topics that pertain to levels and hierarchies:

! Advanced settings that apply to levels and dimensions

! The definition of a hierarchy and how levels define hierarchies

! The process for creating multiple hierarchies in a dimension

! The Grouping property that creates member groupings in dimensions

Topic Objective

To introduce the concept of

levels and hierarchies

Lead-in

In this section, we will

discuss important settings

and processes that enhance

levels and hierarchies

Trang 11

Applying Level Settings

! Member Count

! Key Data Size

! Key Data Type

! Level Type

! Visible

As you click each level in a dimension, you have an assortment of level properties available that enhance various characteristics of levels Each property applies to a level and influences how members in a level are stored and

displayed

Member Count

By default, Analysis Manager counts the members of a level when you create the level This count is important both for the aggregation design algorithm and

in setting up proper hierarchies

Performing the count can be time-consuming when defining a large dimension with many members Therefore, you have the ability to disable the count for dimensions You can disable the count in either of two ways:

! Clear the Count level members automatically check box in the Dimension

Wizard

! Right-click the server and click Properties On the General tab, clear the

Enable dimension level counting check box

You can determine what the count is for any given level of a dimension by

looking at the Member Count property on the Advanced tab of the Properties

pane If the count is zero, then the count is disabled

If you disable the count, you do not have the ability to browse the dimension in the Dimension Editor, and you cannot include the dimension in a cube

Analysis Manager gives you the option of counting members when the counts

are required In addition, you can count the members by clicking the Tools menu and then clicking Count Dimension Members in the Dimension Editor,

or you can manually type in an estimated count for the members in that level

Topic Objective

To describe level settings

and tips for using each of

them effectively

Lead-in

As you click each level in a

dimension, you have an

Open the Dimension Editor

and give an informal

demonstration, clicking

through each of the

properties to show students

how to access properties

Trang 12

Key Data Size

The Key Data Size property records the size in bytes of the columns that store

member keys

Because dimension storage is typically minimal in Analysis Services, it is

usually unnecessary for you to update the Key Data Size to optimize cube

performance However, in dimensions containing millions of members, allocate

the lowest satisfactory amount for the Key Data Size of the levels of the

dimensions

Key Data Type

The Key Data Type property records the data type of the columns that define

member keys The property is set initially when you create the levels of a dimension

If you change the Member Key Column of a particular level, verify that the

Key Data Type updates to the new data type of the column You receive errors

when processing the dimension if the data type of the Member Key Column does not match the Key Data Type setting

Level Type

The Level Type property is set for each level in a dimension and describes the type of each level Most of the available settings for the Level Type property apply to Time dimensions By default, the Level Type of a level is set to

property in presenting levels In addition, some multidimensional expressions

(MDX) functions use the Time level type when performing calculations such as

year to date and quarter to date totals

Trang 13

Visible

The Visible property indicates whether a level is visible or not to users as they browse the cube By default, the property is True When the Visible property of

a level is False, users cannot see the level, but MDX statements can access the

level and members of the level

Change the Visible property of a level to False in the following scenarios:

! You want to use a level in calculations but you do not want users to browse the level in front-end applications

! You want to temporarily remove a level of a dimension You can set the

Visible property to False, and can then change it back to True without

removing the level entirely

! You want to hide a level created with the Grouping property to overcome

the 64,000 children limitation In this case, the level exists to overcome the limitation, and you do not want users to see the fabricated level

The Grouping property is described in detail later in this module

Note

Trang 14

Defining a Hierarchy

! A Hierarchy Is a Set of Members and Levels within a Dimension

! By Default, a Dimension Contains One Hierarchy

! Analysis Services Supports a Variety of Hierarchies

$ Regular hierarchies, which are balanced

$ Parent-child hierarchies, which are unbalanced

$ Ragged hierarchies, which can occur in both regular and parent-child hierarchies

! A Dimension Can Contain Multiple Hierarchies

In the Analysis Services documentation and in the common OLAP vernacular,

the terms dimension and hierarchy are used interchangeably However, to

Analysis Server, there is a subtle difference in the meaning of the two terms The term hierarchy refers to the set of members in a dimension and the levels to which the members belong By default, a dimension contains one hierarchy

The default hierarchy is defined when you assigned the levels and the Member

Key Columns in a dimension

Analysis Services supports a variety of hierarchies, including:

! Regular hierarchies, which are balanced dimensions by definition

! Parent-child hierarchies, which are unbalanced hierarchies by definition

! Ragged hierarchies, which are supported in regular and parent-child hierarchies

Analysis Services supports multiple hierarchies in a single dimension In other words, you can define multiple groupings of members in a single dimension

Topic Objective

To define the term

hierarchy

Lead-in

The term hierarchy refers to

the set of members in a

dimension and the levels to

which the members belong

Delivery Tip

Tell students that if they

have created dimensions in

the past, they have already

created hierarchies, possibly

without knowing it When

you create a dimension, you

define the default hierarchy

for that dimension

Trang 15

Creating Multiple Hierarchies

Department Dimension

Department.Management

Region 1 Department.Region

Region 2 Department A

Department D Department C Department B

Manager 1

Department B

Department D Department C Department A

Manager 2

Two Hierarchies

Creating multiple hierarchies in a dimension is very straightforward in Analysis Services If you have the skills to create multiple dimensions in an OLAP database, you have the skills to create multiple hierarchies in a dimension

To create multiple hierarchies in one dimension, perform the following steps in the Dimension Wizard:

1 For each hierarchy, create a new dimension

2 At the final step of the wizard, name each dimension and select the Create a

hierarchy of a dimension check box Type the hierarchy name and click

Finish The final name format is DimensionName.HierarchyName

You can create a hierarchy by using the Dimension Editor Simply

name the dimension with the format DimensionName.HierarchyName

3 Add the two hierarchies to the cube as if they were separate dimensions

4 View the hierarchies in the cube The way the front end displays the hierarchies depends on the front-end application and how it handles multiple hierarchies in a dimension

The two department hierarchies in the slide illustration are named

Department.Region and Department.Management The Department.Region

hierarchy contains two levels—Region and Department The

Department.Management hierarchy contains two levels, also—Manager and Department Both hierarchies contain the same number of departments

However, the departments consolidate differently based on their Region and

Ask students if they can

think of a use for multiple

hierarchies in their own

companies

Note

Note

Trang 16

Grouping Members into Levels

In addition, users do not want to see thousands of children when they drill down

on a parent

Using the Grouping Property

The level property Grouping solves the potential problem of the 64,000 children limitation Grouping creates intermediate parents in the level The

children are broken into meaningful hierarchies, which makes the members at the level more easily understood by users and eliminates the problem of having more than 64,000 children per parent

You have no direct control over the number of groups created by automatic grouping Automatic grouping creates approximately the same number of groups as there are members in each group by using the square root

of the number of members This strategy enables grouping to automatically handle dimensions with over four billion members (64,000 groups with 64,000 members each) If you want to control the groups, create expressions for the

Member Key Column and Member Name Column properties

First, introduce the large

level that does not contain

higher classification in the

dimension table Next, build

the Grouping Level, and

tell students that the

Grouping Level can be

created by setting the

Grouping property, or by

creating expressions in

Member Key and Member

Name Columns

Tell students that they will

create both types of levels in

the upcoming labs

Note

Trang 17

Using Expressions to Group Members

You can use the flexible nature of the Member Key Column to group members into separate clusters You create expressions in the Member Key

Column to derive a hierarchy from a single relational database management

system (RDBMS) column

For example, suppose you create a customer dimension from visitors to a Web site The system does not contain any information about the customer other than name and e-mail address In addition, the number of customers exceeds 64,000

The grouping of the first letter of the customer’s name can be used to add an arbitrary level to the hierarchy

The following table contains two columns—the first column contains the first letter of the customer name, and the second column contains the customer name The users see the two-level structure when they drill down into the

Customer dimension

C Castillo

D Derry

Dumin

H Hance Hunt

M Masters Mehlert

If your customer table does not contain a column with the first letter of the

customer name, but it does contain the column Customer_Name, you can

create the two-level hierarchy by performing the following steps:

1 Add two levels to the dimension, both based on the Customer_Name

column

2 In the top level, update the Member Key Column and the Member Name

Column so that they contain the following expression:

Note

Trang 18

# Working with Time Dimensions

! Using the Dimension Wizard to Create Dates

! Using a Separate Table for Dates

! Setting Time Dimension Properties

! Creating a Fiscal Date Hierarchy

! Building a Date Hierarchy from a String

Nearly every OLAP database has a Time dimension Often, a Time dimension contains months as the lowest level of detail—aggregated into quarters and years Sometimes, a Time dimension contains days at the lowest level of detail

On occasion, particularly if you are monitoring a manufacturing operation, a Time dimension has minutes or even seconds as the lowest level of detail Whatever the level of detail, a Time dimension has certain unique qualities In this section, you will learn about the characteristics of Time dimensions and how to create them in OLAP cubes

The following specific topics are covered:

! Creating dates by using the Dimension Wizard

! Using a separate dimension table for dates

! Setting Time dimension properties

! Creating a fiscal date hierarchy

! Building a hierarchy from a string

Topic Objective

To introduce the concept of

Time dimensions

Lead-in

Nearly every OLAP

database has a Time

dimension

Trang 19

Using the Dimension Wizard to Create Dates

! When Possible, It Is Best Practice to Use the Dimension Wizard When Creating Time Dimensions

! Contains Built-In Intelligence

! Defines Entire Hierarchy From a Single Date/Time Column

! Uses Appropriate Functions Depending on Data Source

! Is Available for Modification in the Dimension Editor After Initially Created

If it is possible with your required Time levels, the best practice is to create a new Time dimension by using the Dimension Wizard instead of the Dimension Editor The Dimension Wizard constructs an entire hierarchy from a single Date/Time column and uses built-in intelligence to define the levels

Any valid SQL statement can be used for the Member Key Column and the

Member Name Column The Dimension Wizard automatically uses

appropriate data source functions in the Member Key and Member Name

Columns to create the levels

The following table contains expressions that are automatically created for a SQL Server 2000 data source by using the Dimension Wizard

Year DatePart(year,"dbo"."TimeMonth"."Month")

Quarter DatePart(quarter,"dbo"."TimeMonth"."Month")

Month DatePart(month,"dbo"."TimeMonth"."Month")

After you create a Time dimension in the Dimension Wizard, you can modify it

by using the Dimension Editor For example, if you want to see the day name as

Month – Day, you can concatenate the month and day expressions in the

Member Name Column of the day level

The DatePart function used in the preceding example is not a standard

relational database function—it is a function supported by SQL Server and Microsoft Access When working with other supported RDBMS sources, the Dimension Wizard generates a correct expression for that RDBMS

Topic Objective

To describe the benefits of

using the Dimension Wizard

when creating Time

dimensions

Lead-in

The Dimension Wizard can

construct an entire hierarchy

from a single Date/Time

column

Key Point

When you create a new

Time dimension, the best

practice is to create it by

using the Dimension Wizard

instead of the Dimension

Editor

Trang 20

Using a Separate Table for Dates

! Contains Additional Date Properties

! Reduces Storage Space

! Is Used with Multiple Fact Tables

When you design a data warehouse to use with Analysis Services, it is generally

a best practice to create a separate dimension table for dates rather than use a

Date/Time column in the fact table

As with other dimension tables, you use an integer key to join the date dimension table with the fact table Creating a separate date dimension table has

certain advantages over storing a Date/Time column in the fact table

Contains Additional Date Properties

One advantage of creating a separate date dimension table is that a date dimension table can contain additional properties for a date, such as the season for a month or a holiday flag for a day

In addition, some organizations define fiscal months and quarters by arbitrarily assigning four weeks to the first two months of a quarter and five weeks to the third month, or five weeks to the first month of a quarter and four weeks to the second and third months In this case, an expression cannot derive the fiscal

month or quarter from a Date/Time column, but a date dimension table could

easily store the fiscal month and quarter values

Reduces Storage Space

A separate date dimension usually reduces total storage space for a warehouse

A Date/Time column requires eight bytes, while an integer key typically

requires four bytes If a fact table contains millions, or even thousands, of records, the savings from a smaller key column in the fact table more than offsets the size of a date dimension table containing only a few hundred records

In addition, designing and processing a dimension based on a table with only a few records is much faster than extracting dimension values from a large fact table

Topic Objective

To explain the benefits of

creating a separate date

dimension table in the cube

data source

Lead-in

When you design a data

warehouse to use with

Analysis Services, it is

generally a best practice to

create a separate dimension

table for dates rather than

use a Date/Time column in

the fact table

Trang 21

Is Used with Multiple Fact Tables

A separate date dimension table can be used with more than one fact table This allows you to create a single, shared date dimension for multiple cubes A shared dimension allows you to create a virtual cube to compare measures from multiple cubes

For more information about virtual cubes, see module 12, “Working with

Virtual Cubes,” in course 2074A, Designing and Implementing OLAP Solutions with Microsoft SQL Server 2000

Note

Trang 22

Setting Time Dimension Properties

! Some MDX Functions Use Time Dimension Properties

! Third-Party Products Use Time Properties

! Several Time Dimension Level Properties Exist

! The Type Property Has No Effect on the Analysis Server

Time periods typically occur in regular intervals Each hour contains 60 minutes, each day contains 24 hours, each quarter contains 3 months, each year contains 4 quarters, and so forth

This repetitive nature of time periods encourages certain standard analysis questions such as:

! How does the current month compare to the same month of last year?

! How does the current quarter compare to the prior quarter?

The MDX language contains functions that make it easy to answer these types

of questions By flagging certain dimensions as Time, and certain levels in a dimension as specific units of time, you can take advantage of these time-intelligent MDX functions

Many user interface products from third parties take advantage of Analysis Services Time dimension and level properties Depending on the product, Time dimensions display differently than other dimensions

Topic Objective

To describe Time dimension

properties and explain why

they are used in cubes

Lead-in

By flagging certain

dimensions as Time, and

certain levels in a dimension

as specific units of time, you

can take advantage of

time-intelligent MDX functions

Trang 23

In addition to the Time dimension type, the following types are available for

levels in Time dimensions:

The Type property of a dimension and the Level Type property of a level are

significant only when dealing with a Time dimension Even in a Time dimension, these properties are not critical

The Type property of a dimension or a level has no direct effect on the Analysis Server The Type property is available for a client application to

inspect and for certain MDX functions However, the server does not behave

differently when a dimension or level has a Time value for the Type property You can change the Type property of a Time dimension to Standard or that of

a Product dimension to Time It does not matter to the server

Note

Trang 24

Creating a Fiscal Date Hierarchy

! May Not Begin on January 1

! Is Used for Internal Reporting Purposes

! Causes the Need for Multiple Hierarchies within a Time Dimension

$ Fiscal date hierarchy

$ Calendar date hierarchy

One irregularity that frequently arises when dealing with time is that many organizations use a fiscal year in which the starting day of the year is not January 1

Sometimes, a company uses a fiscal year for internal reporting purposes but must still use a calendar year when communicating with customers The same lowest level data—for example, March 1, 2000—could be the first month of a fiscal year and the third month of the calendar year

To choose which way to display that lowest level date, you must use two different hierarchies Analysis Services allows you to define separate hierarchies when you create the dimension Because you cannot rename an existing shared dimension, you must plan for multiple hierarchies before creating the dimension

Topic Objective

To describe the need for

fiscal date hierarchies

Lead-in

One irregularity that

frequently arises when

dealing with time is that

many organizations use a

fiscal year—when the

starting day of the year is

not January 1

Delivery Tips

Tell students that they will

be creating a fiscal

hierarchy in the lab

Ask students if they use

multiple time hierarchies in

their own reporting systems

Trang 25

Building a Date Hierarchy from a String

! May Not Be Able to Create New Tables within the Data Warehouse

! Can Use Dates Stored as Strings

! Can Use Expressions to Define Time Dimensions

You do not always have control over the source RDBMS that defines the dimensions and cubes Often, you are provided with the data warehouse and you must work with it without having the flexibility of creating new tables to define dimensions and cubes

When building a Time hierarchy from a Date/Time column, you can use

Analysis Manager’s built-in date intelligence to define Time dimension levels and members However, in many systems, dates are stored as strings and no

Date/Time columns exist from which to define Time dimension levels

When you only have string columns to build Time dimensions, you can use

expressions in the Member Key Column and Member Name Column to

define the levels and members In addition, you can update the dimension and

level Type properties to specify the Time dimensions

Topic Objective

To describe the issue of

using strings to define Time

dimensions

Lead-in

You do not always have

control over the source

relational database

management system

(RDBMS) that defines the

dimensions and cubes

Delivery Tips

For more information about

using expressions to define

dimensions, see module 4,

“Building Dimensions Using

the Dimension Editor,” in

course 2074A, Designing

and Implementing OLAP

Solutions with Microsoft

Trang 26

Lab A: Creating Time Dimensions

Objectives

After completing this lab, you will be able to:

! Create a Time dimension by using the Dimension Wizard

! Add a hierarchy to an existing dimension

Prerequisites

Before working on this lab, you must have:

! Experience working with the Dimension Editor

! An understanding of dimension, level, and member properties

Estimated time to complete this lab: 15 minutes

Topic Objective

To introduce the lab

Lead-in

In this lab, you will use the

Dimension Wizard and the

Dimension Editor to create

Time dimensions

Explain the lab objectives

Trang 27

Exercise 1

Creating the Time.Calendar Dimension

In this exercise, you will create a calendar Time dimension hierarchy by using the Dimension Wizard to define levels You will also see how the Dimension

Wizard uses expressions in the Member Name Column and Member Key

Column properties to create a hierarchy from a single date value

1 In Analysis Manager, right-click the server, click Restore Database, click the Look in list, click the file C:\Moc\2074A\Labfiles\L05\Module

05.CAB, click Open, and then click Restore

2 After the database successfully restores, click Close

3 Double-click Module 05 to expand the database

4 Below Module 05, double-click Data Sources, right-click the Module 05 data source, and then click Edit

5 Click the Connection tab of the Data Link Properties dialog box, and then verify that localhost is selected in step 1

6 In step 2, click Use Windows NT Integrated security

7 In step 3, click Module 05 from the Select the database on the server list

8 Click Test Connection and verify that the test succeeded, click OK, and then click OK to close the Data Link Properties dialog box

1 In Analysis Manager, beneath Module 05, right-click the Shared

Dimensions folder, point to New Dimension, and then click Wizard

2 Click Next, click Star Schema: A single dimension table, and then click

Next

3 Click the TimeMonth table, and then click Next

4 Click Time dimension, and then click Next

5 In the Select time levels list, click Year, Quarter, Month, and then click

Next Click Next to skip the Select advanced options step

6 Type Time as the name of the dimension, select the Create a hierarchy of

a dimension check box, and then type Calendar in the Hierarchy name

box that appears

7 Click Finish to create the dimension

The Dimension Wizard leaves you in the Dimension Editor with a new

dimension named Time.Calendar Because the wizard already created and

saved the dimension, you cannot change its name in the Properties pane

Trang 28

! To view the Time dimension

1 In the Dimension Editor, browse the Time.Calendar dimension in the Data

pane

2 Click the Time.Calendar dimension in the dimension tree, and then click the Advanced tab in the Properties pane

The value of the Type property is Time

3 Change the name of the Year level to Calendar Year, the name of the

Quarter level to Calendar Quarter, and the name of the Month level to Calendar Month

4 Click the Advanced tab and notice the value of the Level Type property as

you click the various levels

The Dimension Wizard sets the value of each Level Type to match the type

of time data stored in the level

5 Click the Calendar Year level, and then click the Basic tab of the Properties pane Compare the values of the Member Key Column and the

Member Name Column properties

Both are the same, and both contain the expression that extracts the

four-digit year from a Date/Time column:

DatePart(year,"dbo"."TimeMonth"."Month")

6 Click the Calendar Month level, and compare the values of the Member

Key Column and the Member Name Column properties

The expression for the Member Key Column is:

DatePart(month,"dbo"."TimeMonth"."Month")

The expression for the Member Name Column is:

convert(CHAR, DateName(month,"dbo"."TimeMonth"."Month"))

7 Click the Calendar Quarter level, and look at the expression for the

Member Name Column

'Quarter ' + convert(CHAR, DatePart(quarter,"dbo"."TimeMonth"."Month"))

8 Change the expression in the Member Name Column to display only Qtr

as a prefix instead of Quarter Press ENTER, and then browse the dimension

to see the revised member names

9 Click Save, and then close the Dimension Editor

Trang 29

Exercise 2

Creating the Time.Fiscal Dimension

In this exercise, you will create a fiscal year hierarchy by using the Dimension Wizard to define the levels and members This hierarchy, when added to a cube

containing the Time.Calendar hierarchy, will give you another way to

summarize monthly data You will perform the same steps in as in Exercise 1, but will give this hierarchy the name required to include the hierarchy in the

existing Time dimension

1 In Analysis Manager, beneath Module 05, right-click the Shared

Dimensions folder, point to New Dimension, and then click Wizard

2 Click Next, click Star Schema: A single dimension table, and then click

Next

3 Click the TimeMonth table, and then click Next

4 Click Time dimension and then click Next

5 In the Select time levels list, click Year, Quarter, Month

6 Click March as the starting month for the year, and then click Next twice

7 Type Time as the name of the dimension, select the Create a hierarchy of

a dimension check box, and then type Fiscal in the Hierarchy name box

that appears

8 Click Finish to create the dimension

This creates a second hierarchy for the Time dimension

1 In the Dimension Editor, browse the Time.Fiscal dimension in the Data

pane

2 Click the Time.Fiscal dimension in the dimension tree, and then click the

Advanced tab in the Properties pane Change the Type property to Standard

You want to make the Time.Calendar hierarchy the default Time hierarchy Therefore, you set the Time.Fiscal dimension type to Standard

3 Change the name of the Year level to Fiscal Year, the name of the Quarter level to Fiscal Quarter, and the name of the Month level to Fiscal Month

4 In the Dimension Members pane, expand All Time, 2001, and Quarter 4 The months of the quarter appear, with December correctly preceding

January

5 Click Save to save the Time.Fiscal dimension, and then close the

Dimension Editor to return to the Analysis Manager console view

Trang 30

Lab B: Creating Hierarchies from Single Columns

Objectives

After completing this lab, you will be able to:

! Create a Time dimension by using the Dimension Editor and expressions

! Creating a level by using the Grouping property

Prerequisites

Before working on this lab, you must have:

! Experience working with the Dimension Editor

! An understanding of dimension, level, and member properties

In this lab, you will use

expressions and the

Grouping property to create

multilevel hierarchies from

single columns

Explain the lab objectives

Trang 31

Exercise 1

Creating the TextTime Dimension

In this exercise, you will create a Time dimension by using the Dimension Editor to create the hierarchy of levels By using a text column instead of a Date/Time column, you will define three time levels You will update the

Member Key Column and the Member Name Column and will use various

SQL Server string functions Finally, you will update the appropriate dimension and level properties, defining the dimension as a Time dimension

1 In Analysis Manager, beneath Module 05, create a new dimension by using

the Dimension Editor

2 Click TextTime in the Choose a Dimension Table dialog box and then click OK

3 Name the dimension TextTime

4 In the Schema pane, browse the data in the TextTime table Notice the one

column text-based format

You will define three new levels based on the column The level names are

Year, Quarter, and Period

5 Close the Browse Data window

1 In the TextTime table, double-click the Date column three times

Notice the three levels in the TextTime dimension tree: Date, Date 1, and

Date 2 Analysis Services automatically adds integers to the end of a level

name having the same name as another level

2 From the top level to the bottom level, rename the levels Year, Quarter, and Period

3 In the Data pane, preview the dimension and expand the dimension to the

Period level

Trang 32

! To update the Year level

1 Using the Left string function, update the Member Name Column of the

Year level to extract the four leftmost characters from the column

Use the following expression in the Member Name Column:

Left("dbo"."TextTime"."Date", 4)

2 Press ENTER Notice the error you receive when attempting to browse the dimension in the Data pane

Why is the expression causing an error in the dimension?

The Year level is created from the Member Key Column After the

Member Key Column builds the level, the Member Name Column

attempts to name every member in the level When the Member Key

contains 24 members, because the Date table contains 24 distinct records

Twelve of the members are periods found in 2000 and the other twelve members are periods found in 2001

When the Member Name Column attempts to name the 24 members by

using the expression Left("dbo"."TextTime"."Date", 4), it extracts the first four characters of each member The characters are either 2000 or

2001, depending on the year of the period Because the Year level members have one parent, All TextTime, all members must be unique at the level Therefore, applying the expression to the Member Name Column causes you to receive the uniqueness error, due to the level containing twelve 2000 members and twelve 2001 members

3 Change the Member Name Column to the original value,

the Member Key Column

4 Preview the dimension in the Dimension Members pane Notice the 24

members in the Year level

5 Update the Member Key Column of the Year level with the following

expression:

Left("dbo"."TextTime"."Date", 4)

6 Preview the dimension Notice the two members and their member names The level contains two members—one beginning with 2000 and the other beginning with 2001 However, the member names do not reflect the new expression Why is the member name incorrect?

The Member Name Column is still basing the member name directly from the Date column Therefore, you must update the Member Name Column

value also

7 Update the Member Name Column with the expression

Left("dbo"."TextTime"."Date", 4) by copying and pasting the

expression from the Member Key Column

8 Preview the dimension and notice the correct member names

Ngày đăng: 18/01/2014, 05:20

TỪ KHÓA LIÊN QUAN