In addition, the module reviews how calculated cells differ from calculated members and custom member formulas.. If the dimension is shared, write-enabled, or child—then you do not need
Trang 1Contents
Overview 1
Lab A: Creating a Calculated Cells Formula 17
Review 20
Module 9: Using Calculated Cells
Trang 2products, 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
Trang 3Instructor 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
Trang 4Instructor 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
Trang 51 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 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
parent-on the dimensiparent-on and process the cube using at least the refresh optiparent-on
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
Trang 6Module 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
Trang 7Overview
! 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
In this module, you will learn
about calculated cells and
how to use them
Trang 8# Using Calculated Cells
! Group Activity: Creating a Custom Member Formula
! Group Activity: Creating a Calculated Cells Formula
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
Briefly explain the bullets on
this diamond slide to provide
context for the upcoming
group activity in which the
items are functionally
demonstrated
Trang 9Group 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
Trang 102 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
Trang 114 To display source tables in the right pane, click the Schema tab, in the Account table, right-click the caption, click Browse Data, and then widen the window as needed to see the entire Formula column
The Formula column contains a LookupCube formula for the Revenue member The LookupCube formula has two string arguments: the first is
the name of the cube and the second is a tuple—it can be a partial tuple—that designates the cell to retrieve
Any dimension not included in the tuple uses the current member of the dimension If a dimension in the source cube does not exist in the current cube, the tuple uses the default member of the dimension unless you specify otherwise
! To create a new custom member formula for Revenue
In this procedure, you create a custom member formula
1 Close the Browse Data window, in the left pane cube tree, expand the Account dimension, and then click the Account Id level In the Properties pane, click the Advanced tab, click the Custom Member property, and then click the ellipsis (…) button
You can edit the properties of the Account dimension in the Cube Editor
because it is a private dimension
Trang 122 In the Define Custom Member Column dialog box, select the Enable Custom Members check box Select the Use an existing column option, ,
in the Existing column list, click Formula, and then to close the dialog box click OK
! To write-enable the Account dimension
In this procedure, you write-enable the Account dimension so that you can
change the member formula directly from the Cube Editor
1 Click the Account dimension, on the Advanced tab of the Properties pane, click the Write-enabled property, and then in the list click True
2 Click Save, when warned that one or more private dimensions will be updated, click Yes, and then close the log window
3 Click Process Cube, and when asked to design storage, click No, click Full Process, click OK, and then close the log window
! To create a new custom member formula for Revenue
In this procedure, you create a custom member formula for Revenue by using the LookupCube function
1 In the dimension tree in the left pane of the Cube Editor, right-click the
Account dimension, and then click Browse
2 Expand the All Account, Net Profit, and Gross Profit members, and then select the Revenue member
Trang 133 In the Custom Member Formula box, type the formula
LookupCube(“Sales”,”[Sales Dollars]”) Be sure to type quotation marks around each argument
4 Click Close, and then when prompted to save the dimension changes, click Yes
5 Click Save, when warned that one or more private dimensions will be updated, click Yes, and then close the log window
6 Click Process Cube, when asked to design storage click No, click Full Process, click OK, and then close the log window
! To review the results of the custom member formula for Revenue
In this procedure, you view the results of the custom member formula
1 To browse the cube in the right pane, click the Data tab, and then make sure that Actual is the Scenario