Tải bản đầy đủ (.pdf) (26 trang)

Tài liệu Module 9: Using Calculated Cells pdf

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (869.66 KB, 26 trang )





Contents
Overview 1
Using Calculated Cells 2
Lab A: Creating a Calculated Cells Formula 17
Review 20

Module 9: Using
Calculated Cells

BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY

Information in this document is subject to change without notice. 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. 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, your 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.

Content developed by OLAP Train, Inc. for Microsoft Corporation and distributed under license.

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.


Module 9: Using Calculated Cells iii

BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY

Instructor Notes
In this module, students learn how to work with calculated cells in Microsoft
®

SQL Server

2000 Analysis Services. Calculated cells are a method of
applying multidimensional expressions (MDX) in an extremely sophisticated
fashion within a cube. In addition, the module reviews how calculated cells
differ from calculated members and custom member formulas.
After completing this module, students will be able to:

!
Retrieve revenues from the Sales cube by using the LookupCube function.

Materials and Preparation
This section provides you with the required materials and preparation tasks that
are needed to teach this module.
Required Materials
To teach this module, you need the following materials:
!
Microsoft PowerPoint
®
file 2093A_09.ppt

Preparation Tasks
To prepare for this module, you should:
!
Read all of the materials for this module.
!
Read the instructor notes and margin notes.
!
Practice the lecture and demonstration.
!
Complete the labs.
!
Review the Teacher Preparation materials on the Teacher Preparation
compact disc.

Presentation:
45 Minutes


Labs:
15 Minutes
iv Module 9: Using Calculated Cells

BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY


Instructor Setup for Group Activities and Labs
This section provides setup instructions that are required to prepare the
instructor computer or classroom configuration for group activities and labs.
All group activities and labs use the same database setup, which requires
restoring a database archive.
!
To prepare for group activities and labs
In this procedure, you restore the Market database, which is a .cab file type.
1. Start Analysis Manager.
2. In the left pane, expand the Analysis Services folder.
3. Expand the Server icon and verify that the Market database does not exist.
4. Right-click the Server icon, and then click Restore Database.
5. Navigate to the C:\Moc\2093A\Batches folder.
6. Select Market.cab, click Open, and then click Restore.

If the Market database already exists from a previous group exercise or lab,
and cubes within the database contain extraneous information, you can return
the Market database and its cubes to a beginning position by either:
Deleting any calculated members that were created in a specific cube, and then
saving the cube.
- or -
Repeating the preceding restore database procedure.


Module 9: Using Calculated Cells v

BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY

Other Activities
Difficult Questions
The following list presents several 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 in the scope of the module but may not be
specifically addressed in the content of the student notes.
1. Can the LookupCube function retrieve a value from a different database?
No. The cube must be in the same database. If you use linked cubes, you
can technically get values from a cube that is on another server, but it
still must be linked to the same cube.
2. Do you have to process a cube after adding a custom member formula?
Generally, yes. If the dimension is shared, write-enabled, or parent-
child—then you do not need to process the cube after adding a custom
member formula. Otherwise, if the dimension is private, not write-
enabled, or not parent-child, you must perform an incremental update
on the dimension and process the cube using at least the refresh option.
3. Can a custom member formula refer to the value of a calculated member?
Yes. A custom member formula can use any MDX expression that is
meaningful in the context of the cube.
4. Can a LookupCube formula refer to the parent of the current member?
Yes, but it won’t happen automatically. In order to use the Parent
function—or some other member function—you must construct a
string that pieces together the unique name of the member with the rest
of the tuple.
5. What limitations are there on the MDX expression you can use in calculated
cells?

You can use any MDX expression that is meaningful in the context of
the cube.
6. Is there any way to integrate a calculated member into the aggregation of a
cube?
Not easily, but you could create a custom rollup formula that refers to
the calculated member.

vi Module 9: Using Calculated Cells

BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY

Module Strategy
Major sections of this module begin with or include a group activity followed
by review lecture and then labs. The following are guidelines for delivering
materials in the context of group activities:
!
Using group activities to introduce new content
You often introduce new concepts or functionality while delivering the
procedures in a group activity as a live demonstration. For example, you
may present a new MDX function by showing first its construction and then
its result set as an actual calculated member formula or in a query statement.
Use the topic slides that follow the group activity as a review of the
content—for example, the syntax of a specific function.
!
Interaction with students
A group activity flows best when you deliver it as a shared exploration. Ask
students such questions as: “What would happen if we…?” “Why did this
happen?” “Was that what you expected?” Encourage students to ask you
questions about the functions being tested.
!

Students follow along
In some cases, you may want to encourage students to follow your live
demonstration on their own computers. This practice works best for simpler
group activities or for a group activity that is not replicated by a later lab.
It is not a problem if a student does not follow your demonstration, or if a
student starts following and then stops before the group activity is
completed. There is no file or structure dependency between group activities
or between a group activity and a later lab.
!
Lab replication of group activity
The exercises in the labs closely follow the group activity procedures but do
not define each step or show the code answer. Encourage students to write
and test the MDX expressions on their own, referring back to the group
activity procedures for clarification. Students may also refer to answer files,
which are available for each procedure in an exercise.
Labs are generally more challenging when students have not followed the
instructor on their own computers during the group activity. However, many
students benefit from the two hands-on experiences of following the group
activity and then completing the labs.
!
Answer files for group activities
Where applicable, answer files are provided for each procedure in group
activities. If necessary to facilitate your demonstration, copy and paste the
correct expression from the answer file into the Calculated Member Builder.

Use the following additional strategies to present this module:
!
Using Calculated Cells
Teach how to use the LookupCube function, which retrieves a value from a
different cube. Then review calculated value types, comparing them with

calculated members, custom members, and calculated cells. Further explain
the member source and formula scope for calculated members, custom
members and calculated cells.
Module 9: Using Calculated Cells 1

BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY

Overview
!
Using Calculated Cells


In this module, you will learn how to work with calculated cells in Microsoft
®

SQL Server

2000 Analysis Services. Calculated cells are a method of
applying multidimensional expressions (MDX) in an extremely sophisticated
fashion within a cube. In addition, the module reviews how calculated cells
differ from calculated members and custom member formulas.
After completing this module, you will be able to:
!
Retrieve revenues from the Sales cube by using the LookupCube function.


Topic Objective
To provide an overview of
the module topics and
objectives.

Lead-in
In this module, you will learn
about calculated cells and
how to use them.
2 Module 9: Using Calculated Cells

BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY


#
##
#

Using Calculated Cells
!
Group Activity: Creating a Custom Member Formula
!
Group Activity: Creating a Calculated Cells Formula
!
LookupCube Function
!
Calculated Value Types
!
Member Source
!
Formula Scope


In this module, you will work in the Finance cube, which calculates the income
statement for a fictional company. The cube includes both Actual and Budget

values.
You will work specifically with the Revenue account. For Budget values,
Revenue is stored in the Finance cube. To minimize the risk of inconsistent
data, Actual values are stored in the Sales cube under the member name Sales
Dollars. The objective is to report on Revenue for Actual values in the
Finance cube, retrieving data from the Sales cube.
The group activities introduce the use of a custom member formula to provide
special handling for an entire member and the use of a custom cell formula to
provide special handling for any number of specified members.
The following topics follow the two group activities:
!
LookupCube Function
This topic describes how to use the LookupCube function, which retrieves
a value from a different cube.
!
Calculated Value Types
This topic summarizes the key differences among calculated members,
custom member formulas, and calculated cells.
!
Member Source
This topic provides more detail about one of the key difference between
types of calculated values—the source of the members that use the formula.
!
Formula Scope
This topic provides more detail about the other key difference between types
of calculated values—the scope of the formula.
Topic Objective
To introduce the first
problem for the module—
how to retrieve selected

values from a different cube.
Lead-in
In addition to creating
calculated members in a
cube, you can create
dynamic or temporary
calculated members in an
MDX query statement.
Delivery Tip
Briefly explain the bullets on
this diamond slide to provide
context for the upcoming
group activity in which the
items are functionally
demonstrated.
Module 9: Using Calculated Cells 3

BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY

Group Activity: Creating a Custom Member Formula


In this group activity, you may follow along on your own computer with your
instructor or observe the demonstration.
You will learn how to create a custom member formula to look up the Actual
values for Revenue from the Sales cube.
!
To review existing Revenue values in the Finance cube
In this procedure, you browse the data in the Revenue member of the Account
dimension.

1. In the Analysis Manager, open the Market database, right-click the
Finance cube, click Edit, and then click the Data tab.
The Finance cube contains the following three dimensions:
• The Scenario dimension contains the members Actual and Budget.
• The Time.Calendar dimension contains calendar years, quarters, and
months.
• The Account dimension is a parent-child dimension that includes an
income statement hierarchy.
In this section, you will focus on the Revenue member of the Account
dimension. For the Actual scenario, the Revenue value should come from
the Sales cube. For the Budget scenario, the Revenue value is stored in the
fact table. Start by looking at the Revenue value for the Budget scenario.
Topic Objective
To learn the use of a custom
member formula to provide
special handling for a
member.
Lead-in
Let us see what happens
when we create a custom
member formula to look up
the Actual Revenue value
from the Sales cube.
Delivery Tip
Important: This section does
not have a lab that follows it.
It is intended as a review of
administrative material that
the students should already
have been exposed to. If

students are not familiar
with custom member
formulas, you may want to
proceed slowly and
encourage them to follow
along in the group activity.
4 Module 9: Using Calculated Cells

BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY

2. In the Scenario dimension drop-down list, click the Budget scenario, and
then expand the Net Profit node and the Gross Profit node.

The Revenue value for All Time is 91,200. This is the sum of all the
monthly budgets over 1997 and 1998. Revenue values for Budget were
generated during the same planning process as all the other budget numbers
and were then loaded into the cube from the fact table when the cube was
processed.
3. In the Scenario dimension list, click the Actual scenario.

The Revenue value is blank. Revenue for the Actual scenario are not stored
in the same fact table as the balance of the financial information, but they
can be derived from the Sales cube.
The Revenue member is simply one member of the Account dimension. It
requires special handling—that is, you must treat it differently from the
other members. You can use the LookupCube function to retrieve the
revenue values from the Sales cube, but Revenue is the only member that
should use the LookupCube function.
One way to treat a single member differently from the rest of the dimension
is to use a custom member formula. With a custom member formula, the

formula for a single member can be stored in the dimension table. In the
Account dimension table, there is already a column that contains the
appropriate formula for the Revenue member.

×