Contents
Overview 1
Allocating Values from a Grand Total 2
Lab A: Allocating Values from a Grand Total 6
Allocating Values from a Subtotal 10
Lab B: Allocating Values from a Subtotal 16
Allocating Values Across Multiple Dimensions22
Lab C: Allocating Values Across Multiple
Dimensions 30
Review 35
Module 8: Case
Study—Implementing
Budget Allocations
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 8: Case Study—Implementing Budget Allocations iii
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
Instructor Notes
This module is a case study where you and the students will work through a
single, complex project. In the course of the module, students apply many
concepts and specific multidimensional expressions (MDX) functions they have
learned in previous modules.
The assignment is to allocate Budget Units based on Actual Units. Analysts in
a fictional company have already entered Budget Units values at a high level
into a Sales Budget cube. In the Market database, the Sales Actual and
Budget cubes have been joined in a virtual cube named Actual and Budget.
The student’s job is to allocate the Budget Units in the new Actual and
Budget virtual cube to the lowest levels of all the dimensions based on the
patterns of Actual Units that are contained in the same cube. Actual Units
reflect historical sales patterns. Allocating Budget Units to lower levels based
on historical sales patterns is a typical budget methodology.
In addition to allocating budgets to lower levels, students will also create
expressions that roll up—or aggregate—the lower-level budgeted units back to
higher levels.
After completing this module, students will be able to:
!
Allocate values from a grand total across a dimension.
!
Allocate values from an intermediate level across a dimension.
!
Create a calculated member that allocates values across three dimensions.
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_08.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:
80 Minutes
Labs:
120 Minutes
iv Module 8: Case Study—Implementing Budget Allocations
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 8: Case Study—Implementing Budget Allocations 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. When you allocate a budget, are the allocated values stored in the cube?
No. As with all calculated members, the allocations are calculated only
for cells that actually appear in a browser or a report. Any cells that are
not displayed are not allocated.
2. If the Sales Budget cube does not even contain a State dimension, where
did the All State values come from in the Actual and Budget cube?
If you think of a dimension as subdividing a value, then the All level for
a dimension is the same as not having the dimension at all. Because the
State dimension did not exist in the Sales Budget cube, the only possible
value in the virtual cube is the non-subdivided All level value.
3. The query samples show one member each from multiple levels on the
Rows axis. Is it possible to get that effect by using the Microsoft Office
PivotTable
®
list?
Yes. Move a dimension to the Rows axis and display all the levels. Click
the drop-down arrow next to the button for the top level. Clear the
check boxes for all the members you do not want to see. The Office
PivotTable list requires one column for each level, even if there is only
one member in each column, and you must explicitly hide each member
you don’t want to see.
4. Why does the expression Ancestor(Product,Category) work? Doesn’t the
Ancestor function require a member for the first argument?
The CurrentMember function is the default function for a dimension. If
a member is needed and you enter a dimension, the CurrentMember
function is assumed.
5. Why do you need to use the Crossjoin function when aggregating more
than two dimensions? Why cannot you just sum the values from the two
sets?
The Sum function—as with essentially all aggregation functions—
allows you to enter a single set. You can think of it as a query with a
single axis. If you need to summarize detail values that are calculated at
the intersection of two or more dimensions, you must combine the sets
from those dimensions into a single set, which is what the Crossjoin
function does.
6. What is the difference between the CoalesceEmpty function and the
combination of IIF and IsEmpty functions?
You could replace CoalesceEmpty with a combination of IIF and
IsEmpty. The CoalesceEmpty function avoids the need to duplicate the
value expression, and it also allows you to combine a series of tests in a
single function.
vi Module 8: Case Study—Implementing Budget Allocations
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
Module Strategy
This module is one extended case study project, broken into three steps. Each
step is a section, and each section becomes more complex. The final calculated
member is extremely complex.
Major sections of this module begin with a group activity followed by a lab.
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 within 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 within 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.
!
Discouraging students from following along
Because of the complexity of the issues and the challenging nature of the
labs that immediately follow the group activities in this module, it is
recommended that students do not follow along with the instructor in the
group activities in this module. Encourage students to focus on the content
and structures you are building in the demonstration.
!
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.
!
Answer files for group activities
Where applicable, answer files are provided for each procedure in a group
activity. If necessary to facilitate your demonstration, copy and paste the
correct expression from the answer file into the Calculated Member Builder.
Module 8: Case Study—Implementing Budget Allocations vii
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
Use the following additional strategies to present this module:
!
Allocating Values from a Grand Total
Explain to students that they will be allocating Budget Units, which exist at
the grand total level, to Actual Units, which exist in the cube at the lowest
levels of detail. Describe the two-part process that accomplishes this: first
create allocation ratios and then multiply the grand total values by the
allocation ratios to create detailed values.
!
Allocating Values from a Subtotal
Tell students that this section is an extension of the previous section—
Product, another dimension, is being added to the allocation process.
Explain that budgets for Product are entered at an intermediate level,
thereby complicating the allocation process. Describe the process that
allows them to allocate based on a subtotal—first use the Ancestor function
to find the subtotal to allocate, allocate to lower levels—as in the previous
section—and then aggregate to the higher levels by using the Sum function
in conjunction with the Descendants function.
!
Allocating Values Across Multiple Dimensions
Explain to students that in this section, they will build on the calculated
member that they created in the previous sections to now include a third
dimension—the Time.Calendar dimension. Explain that to include more
than one dimension in the set for a Sum function, they will use the
Crossjoin function to join the sets from the individual dimensions. Finish
by telling students that they will also use the CoalesceEmpty function to
determine whether they actually need to calculate a cell.
Module 8: Case Study—Implementing Budget Allocations 1
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
Overview
!
Allocating Values from a Grand Total
!
Allocating Values from a Subtotal
!
Allocating Values Across Multiple Dimensions
This module is a case study in which you and the instructor will work through a
single, complex project. In the course of the module, you apply many concepts
and specific multidimensional expressions (MDX) functions that you have
learned in previous modules.
The assignment is to allocate Budget Units based on Actual Units. Analysts in
a fictional company have already entered Budget Units values at a high level
into a Sales Budget cube. In the Market database, the Sales Actual and
Budget cubes have been joined in a virtual cube named Actual and Budget.
Your job is to allocate the Budget Units in the new Actual and Budget virtual
cube to the lowest levels of all the dimensions based on the patterns of Actual
Units that are contained in the same cube. Actual Units reflect historical sales
patterns. Allocating Budget Units to lower levels based on historical sales
patterns is a typical budget methodology.
In addition to allocating budgets to lower levels, you will also create
expressions that roll up—or aggregate—the lower-level budgeted units back to
higher levels.
After completing this module, you will be able to:
!
Allocate values from a grand total across a dimension.
!
Allocate values from an intermediate level across a dimension.
!
Create a calculated member that allocates values across three dimensions.
Topic Objective
To provide an overview of
the module topics and
objectives.
Lead-in
This module is a case study
in which you and the
instructor will work through a
single, complex project.
2 Module 8: Case Study—Implementing Budget Allocations
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
Allocating Values from a Grand Total
!
Start with Existing Values
#
Actual units at all levels
#
Budget units at total level
!
Calculate Allocation
#
Allocation ratio—current actual divided by total actual
#
Allocated budget units—total budget multiplied by
allocation ratio
In this section, you will carry out the task of allocating values entered at a total
level.
Start with Existing Values
In the Actual and Budget virtual cube, Actual Units exist at all levels of the
State dimension. Budget Units, however, exist only at the total, or All State,
level.
When you create new values by using an allocation process, you need to have
an allocation basis—that is, some frame of reference that can be used to define
how the allocation process should work. In this case, the allocation basis Actual
Units. The relative quantity of Actual Units at the lowest levels serves as the
basis for allocating Budget Units down to the lowest levels of the State
dimension.
Calculate Allocation
The specific formula for each cell of the allocated budget consists of two steps:
!
Divide the Actual Units for the current member of the State dimension by
the Actual Units value for All State to create a series of allocation ratios.
This ratio is a percentage of total calculation, which you learned in a
previous module.
!
Multiply the allocation ratio for the current member of the State dimension
by the Budget Units value for All State to create the allocated budget.
Topic Objective
To define, conceptually, how
the allocation formula is
constructed.
Lead-in
Now you will learn how to
allocate values at a higher
level to values at the detail
level.
Delivery Tip
This slide topic sets
important foundations for
the following group activity.
Review the concepts and
procedures carefully and
check that students
understand.
Module 8: Case Study—Implementing Budget Allocations 3
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
Group Activity: Allocating Values from a Grand Total
In this group activity, it is recommended that you do not follow along on your
own computer. Instead, focus on the instructor demonstration and discussion of
the allocation process. You will have the opportunity to replicate the allocation
algorithms in the lab that immediately follows this group activity.
You will learn how to create a calculated member that allocates budget values
to the members of a new dimension.
!
To prepare a query for testing a simple allocation
In this procedure, you run a query suitable for testing a calculated member that
allocates a budget values across an entire dimension.
1. In Microsoft
®
Windows
®
Explorer, navigate to the C:\Moc\2093A\Labfiles
folder.
2. Double-click the MDX2093A.exe application, and then click OK to accept
the server and provider.
3. In the Open window, navigate to C:\Moc\2093A\Labfiles\L08, and then
open the Allocation.MDX query file.
Topic Objective
To learn how to allocate
values from a grand total
over an entire dimension.
Lead-in
In this group activity, you will
see how to create a
calculated member that
allocates values to the
members of a new
dimension.
4 Module 8: Case Study—Implementing Budget Allocations
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
4. In the MDX Builder, in the DB list select the Market database, and then in
the Cube list select the Actual and Budget cube. The initial query, Grand
Total Allocation, looks like this:
WITH
MEMBER Measures.[Allocated Budget] as ‘Null’
SELECT
{[Actual Units], [Budget Units], [Allocated Budget]}
ON COLUMNS,
{ [All State] , [USA] , [North West], [Washington]}
ON ROWS
FROM [Actual AND Budget]
5. Run the query.
On the Columns axis, the result set shows the Actual Units and Budget
Units measures, which are stored in the Actual And Budget virtual cube,
along with the empty Allocated Budget measure, which is defined as part of
the query.
On the Rows axis, the result set shows one member from each level of the
State dimension. When analysts entered the original data, they did not break
out the budget along the State dimension. Therefore, the Budget Units
measure shows a total only for the All State member.
!
To display a ratio suitable for calculating an allocation
In this procedure, you learn how to create a ratio that can calculate an
allocation.
You want to allocate the total Budget Units across the various members of the
State dimension by using the same ratio as is in the Actual Units member. To
calculate the proper ratio, you must divide the Actual Units value of the current
member of the State dimension by the Actual Units value of the All State
member.
1. Change the expression for the Allocated Budget member to
[Actual
Units]/([Actual Units],[All State])
. The final query looks like
this:
WITH
MEMBER Measures.[Allocated Budget] as '[Actual
Units]/([Actual Units],[All State])'
SELECT
{[Actual Units], [Budget Units], [Allocated Budget]}
ON COLUMNS,
{[All State] , [USA] , [North West], [Washington]}
ON ROWS
FROM [Actual AND Budget]
Delivery Tip
WithBudgetD.txt in
C:\MOC\2093A\Demo\D08\
Answers contains the
completed MDX expression
for this procedure.
Ask students why you do
not need a member from the
State dimension in the
numerator tuple.
Because you want the
current member, and
CurrentMember is the
default for each unspecified
dimension.
Module 8: Case Study—Implementing Budget Allocations 5
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
2. Run the query.
In the Allocated Budget column, the result set shows the percent each state
contributes to the total for Actual Units.
!
To allocate a budget over an entire dimension
In this procedure, you allocate the Budget Units value across members at all
levels of the State dimension.
You now need to simply multiply the ratio by the total Budget Units. You want
the Budget Units for the All State member, not for the current member, so you
must explicitly include All State in the tuple, as with the tuple already in the
denominator.
1. At the beginning of the expression for the Allocated Budget member, insert
([Budget Units],[All State]) *
. The final query looks like this:
WITH
MEMBER Measures.[Allocated Budget] AS
'([Budget Units],[All State]) * [Actual Units] /
([Actual Units],[All State])'
SELECT
{[Actual Units], [Budget Units], [Allocated Budget]}
ON COLUMNS,
{[All State] , [USA] , [North West], [Washington]}
ON ROWS
FROM [Actual AND Budget]
2. Run the query.
The Allocated Budget column now shows the allocated budget value. By
using the MDX2093A application, you can quickly see the result of the
member over all levels of the dimension.
Delivery Tip
WithAllocationD.txt in
C:\MOC\2093A\Demo\D08\
Answers contains the
completed MDX expression
for this procedure.
Delivery Tip
WithAllStatesD.txt in
C:\MOC\2093A\Demo\M08\
Answers contains the
completed MDX expression
for this procedure.
6 Module 8: Case Study—Implementing Budget Allocations
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
Lab A: Allocating Values from a Grand Total
Objectives
After completing this lab, you will be able to:
!
Divide a base value into the total to create a ratio.
!
Multiply the ratio by a new total to allocate values.
Prerequisites
Before working on this lab, you must have successfully completed modules 1
through 7 in course 2093A, Implementing Business Logic with MDX in
Microsoft SQL Server
™
2000.
Estimated time to complete this lab: 40 minutes
Topic Objective
To introduce the lab.
Lead-in
In this lab, you will create a
calculated member that
allocates values to each
level of a dimension.
Explain the lab objectives.
Module 8: Case Study—Implementing Budget Allocations 7
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
Exercise 1
Creating an Allocation Calculated Member
In this exercise, you will create an MDX query that shows sample members
from multiple levels of the State dimension on the Rows axis. You will then
build an Allocated Budget calculated member to allocate the All State values to
each level of the dimension.
As you complete each procedure, compare the result as shown in the procedure
screen shot to the result on your own computer. If there is a difference, recheck
your entry and refer back to the related group activity procedures as necessary.
If you still cannot reconcile your result, then refer to the answer file, which is
located in:
C:\MOC\2093A\Labfiles\L08\Answers
You can copy and paste expressions from this file into the MDX2093A
application for any given procedure.
!
To display a ratio suitable for calculating an allocation
In this procedure, you create an allocation ratio as the expression for the
Allocated Budget calculated member. OneRatio.txt is a completed MDX
expression used in this procedure.
1. In Windows Explorer, navigate to the C:\Moc\2093A\Labfiles folder.
2. Double-click the MDX2093A.exe application, and then click OK to accept
the server and provider.
3. In the Open window, navigate C:\Moc\2093A\Labfiles\L08, and then open
the LabA.MDX query file.
4. In the MDX Builder, in the DB list select the Market database, and then in
the Cube list select the Actual and Budget cube.
5. Change the expression for the Allocated Budget member to create a ratio
that shows the percent each state contributes to the total.
What MDX expression did you use?
WITH MEMBER Measures.[Allocated Budget] AS
'[Actual Units]/([Actual Units],[All State])'
SELECT
{[Actual Units], [Budget Units], [Allocated Budget]}
ON COLUMNS,
{ [All State] , [USA] , [South West], [California]}
ON ROWS
FROM [Actual AND Budget]
____________________________________________________________
____________________________________________________________
____________________________________________________________
____________________________________________________________
Delivery Tip
The procedures in this
exercise essentially
replicate the previous group
activities but without the
answers.
Students having difficulty
with the procedures should
first refer back to the group
activity procedures and then
go to the answer file for
guidance.
8 Module 8: Case Study—Implementing Budget Allocations
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
6. Run the query, and then verify that the result grid appears similar to the
following table.
7. Why do you not need a member of the State dimension in the numerator
tuple? Why do you need Actual Units in both the numerator and the
denominator tuples?
In the numerator tuple, the State dimension uses the current member,
which can be omitted from a tuple. The Actual Units member is not the
current member of the Measures dimension for either tuple.
____________________________________________________________
____________________________________________________________
!
To allocate Budget Units across the dimension
In this procedure, you change the expression for the Allocated Budget member
so that Budget Units are distributed among all the states. OneAllocate.txt is a
completed MDX expression used in this procedure.
1. Change the expression for the Allocated Budget member to allocate the
Budget Units among all the states, based on the Actual Units contribution.
What MDX expression did you use?
WITH MEMBER Measures.[Allocated Budget] AS
'([Budget Units],[All State]) * [Actual Units]/([Actual
Units],[All State])'
SELECT
{[Actual Units], [Budget Units], [Allocated Budget]}
ON COLUMNS,
{ [All State] , [USA] , [South West], [California]}
ON ROWS
FROM [Actual AND Budget]
____________________________________________________________
____________________________________________________________
____________________________________________________________
____________________________________________________________
Module 8: Case Study—Implementing Budget Allocations 9
BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY
Run the query, and then verify that the result grid appears similar to the
following table.