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

Module 3: Using MDX Expressions

78 323 0
Tài liệu đã được kiểm tra trùng lặp

Đ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

Định dạng
Số trang 78
Dung lượng 1,13 MB

Nội dung

Contents Overview 1 Using MDX Expressions 2 Lab A: Using Expressions from Constants 12 Displaying Member Information 17 Displaying Family Tree Relatives 29 Working with Member Properties 38 Lab B: Displaying Cube Metadata 46 Using Conditional Expressions 55 Lab C: Using Conditional Expressions 64 Review 68 Module 3: Using MDX Expressions 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, ActiveX, Excel, PowerPoint, SQL Server, and Visual Basic for Applications are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries. 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 3: Using MDX Expressions iii BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY Instructor Notes In this module, students will learn how to create very simple multidimensional expressions (MDX). These are expressions that use constant values or expressions that display the names of members. Students will also learn how to work with members in a dimension and how to use MDX member functions to navigate from one member to another. After completing this module, students will be able to: ! Create MDX expressions in calculated members and manipulate the expressions by using numeric and string constants. ! Display information about a member—particularly the name of the member and the name of the level of the member. ! Display information about the parent or other ancestor of a member. ! Display the member property associated with a member, and use the value in an arithmetic expression. ! Create and use simple and complex conditional expressions. 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_03.ppt Preparation Tasks To prepare for this module, you should: ! Read all the materials for this module. ! Read the instructor notes and margin notes. ! Practice the lecture and group activities. ! Complete the labs. ! Review the Trainer Preparation materials on the Trainer Preparation compact disc. Presentation: 100 Minutes Labs: 50 Minutes iv Module 3: Using MDX Expressions 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 in 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 previous restore database procedure. Module 3: Using MDX Expressions v BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY 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. Are calculated members stored in the cube or aggregated? The values of a calculated member are not stored or aggregated. The definition of the calculated member is executed each time a client application establishes a connection to the cube that requests the calculated member’s values. 2. Do calculated members execute for all of the members of the cube? No. A calculated member is executed only when the value is actually displayed on the browser grid. Unless a cell is displayed in the browser, its formula is never calculated. 3. Is the Empty value (Null) a string or a number? The Empty value is treated as a number—typically as the number zero. 4. What is the difference between the four Name functions—dimension, hierarchy, level, and name? There is only one Name function. It will return the name of whatever object it is used with. The four entries in the Functions list simply put different tokens in front of the function name. 5. How do I find the available Microsoft Excel or Microsoft Visual Basic ® for Applications (VBA) functions? Run Books Online for Microsoft Analysis Services, and click the Index page. Type function libraries and choose Excel or VBA. All functions that do not have an asterisk are available for use from MDX. 6. To use an Excel function from MDX, does Excel have to be installed on the client or on the server? Under default conditions, an external library (including Excel or VBA) must be available both on the client on the server. That is because the expression may be evaluated either by PivotTable Services (on the client) or the Analysis server. It is possible to create a connection in a way that forces expressions to be evaluated exclusively on the client or on the server as opposed to the default, which is that the expression could be evaluated in either place, and an external library must be available on both the client and the server. 7. Why does the CurrentMember function follow the dimension name in COM object format, whereas the Ancestor function uses arguments? Some MDX functions use property-style syntax, whereas others use argument-list syntax. Only functions that require no arguments can use the property-style syntax. The choice between the two styles often appears arbitrary, and you simply look at the syntax example to see which to use. vi Module 3: Using MDX Expressions BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY 8. Is there a way for an MDX expression to find out what member properties are available for a given level? No. When using MDX, you must know the name of the member property and the level at which it applies. You cannot refer to a property by number, and you cannot request the count of the properties. You can find this information out programmatically by using Microsoft ActiveX ® Data Objects (Multidimensional) (ADO MD), but not by using an MDX expression. 9. When would you use a string value from an MDX expression in a practical situation? One example is to show the name of the best-selling product for any given state. 10. Can an MDX expression return a date? Typically, when you want to display a date, you are displaying the name of a member on a Time dimension, which is a string. If you want to display a true date or time value, it is really a formatted number. Module 3: Using MDX Expressions vii BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY Module Strategy Each major section of this module begins with a group activity followed by a review lecture and then labs. The following guidelines are 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 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 results 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 can also refer to answer files that are available for each procedure in the exercises. 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 a group activity. If necessary to facilitate your demonstration, copy and paste the correct expression from the answer file into the Calculated Member Builder. viii Module 3: Using MDX Expressions BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY Use the following additional strategies to present this module: ! Using MDX Expressions Introduce the Calculated Member Builder and the concept of an MDX expression as a formula that returns a string or numeric value. Present materials as simply as possible—similar to the classic “Hello, World” programming examples. Emphasize the fact that the MDX expression in the calculated member is calculated anew for each cell in which it displays—even if it is a constant value. Point out that entering a constant as the value of a calculated member is similar to entering a constant value in a spreadsheet cell. Compare with a spreadsheet formula, in which it is possible to manually change some of the formulas in a column, to MDX, in which all the copies of a formula are identical according to the MDX formula definition. ! Displaying Member Information Use the example of the Name function, which must explicitly use the CurrentMember function, as a method to return a member’s name. Point out how the Level.Name part of the section shows the versatility of the Name function and is useful in advanced calculations. Reinforce the differences among a dimension, a level, and a member because students are often confused by these concepts and how they relate to each other. Minimize the importance of a hierarchy. ! Displaying Family Tree Relatives Focus on the Parent and Ancestor functions, which are extremely useful for advanced calculations. Point out the possibility of using Ancestor to determine security information. ! Working with Member Properties Point out how a member property can be easily viewed and manipulated without accessing the actual data values in a cube. Clearly explain that the #ERR values are normal and to be expected. Keep the focus on the level where the member property does exist. Show the students how to use Books Online to find the complete list of VBA and Excel functions. ! Using Conditional Expressions Keep the focus on constructing simple conditional expressions. The IIF function that follows is easy for students to understand after they understand basic conditional expressions. Module 3: Using MDX Expressions 1 BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY Overview ! Using MDX Expressions ! Displaying Member Information ! Displaying Family Tree Relatives ! Working with Member Properties ! Using Conditional Expressions In this module, you will learn how to create very simple multidimensional expressions (MDX). These are expressions that use constant values or expressions that display the names of members. You will also learn how to work with members in a dimension, and how to use MDX member functions to navigate from one member to another. After completing this module, you will be able to: ! Create MDX expressions in calculated members and manipulate the expressions by using numeric and string constants. ! Display information about a member—particularly the name of the member and the name of the level of the member. ! Display information about the parent or other ancestor of a member. ! Display the member property associated with a member, and use the value in an arithmetic expression. ! Create and use simple and complex conditional expressions. Topic Objective To provide an overview of the module topics and objectives. Lead-in In this module, you will learn how to create calculating members by using MDX expressions plus how to view metadata and work with conditionals. 2 Module 3: Using MDX Expressions BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY # ## # Using MDX Expressions ! Group Activity: Creating Expressions with Constants ! MDX Expressions ! Expression Operators In this section, you learn about the basic elements of MDX expressions, including how to use them to create calculated members and how to construct MDX expressions by using arithmetic operators and string text. This group activity introduces concepts and mechanics for creating MDX expressions by using constants. Topics that follow the group activity include: ! MDX Expressions This topic describes how MDX expressions are used to create calculated members. Calculated members add the calculating ability of a spreadsheet to an online analytical processing (OLAP) database. ! Expression Operators This topic describes how expression operators are used in MDX expressions to return a value that can result from an arithmetic or string text manipulation. Topic Objective To provide an overview of the topics in this section. Lead-in MDX expressions are formulas that have different types of values and use traditional arithmetic and string text operators. Delivery Tip Briefly explain the bullets on this slide to provide context for the upcoming group activity in which the items are functionally demonstrated. [...]... CERTIFIED TRAINER PREPARATION PURPOSES ONLY Module 3: Using MDX Expressions 9 Tip When you first create a new calculated member, assign Null as its value You can then see the empty cells in the browser, which helps you think of an expression in concrete terms BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY 10 Module 3: Using MDX Expressions Expression Operators Topic Objective... PREPARATION PURPOSES ONLY 12 Module 3: Using MDX Expressions Lab A: Using Expressions from Constants Topic Objective To introduce the lab Lead-in In this lab, you will create simple calculated members by using constants and operators Objectives Explain the lab objectives After completing this lab, you will be able to: ! Use the Calculated Member Builder ! Create simple expressions by using constants Prerequisites... PURPOSES ONLY Module 3: Using MDX Expressions 11 Consider the following facts and guidelines when using MDX expression operators: ! In an MDX expression, you can use any standard arithmetic operator: • Plus sign (+) for addition • Minus sign (-) for subtraction • Asterisk (*) for multiplication • Slash mark (/) for division • Caret (^) for raising to a power (exponent) ! The value of an MDX expression... PREPARATION PURPOSES ONLY 8 Module 3: Using MDX Expressions MDX Expressions Topic Objective To highlight the types of data values that can be used in an expression ! Are Used to Create Calculated Members ! Function Like Spreadsheet Formulas Lead-in $ The most important use for an MDX expression is as the value of a calculated member Calculated for each cell of browser grid ! Are Entered by Using the Calculated.. .Module 3: Using MDX Expressions 3 Group Activity: Creating Expressions with Constants Topic Objective To learn expressions by using constants and formulas with constants Lead-in In this group activity, you will learn how to create simple calculated members that return... CERTIFIED TRAINER PREPARATION PURPOSES ONLY Module 3: Using MDX Expressions 17 # Displaying Member Information Topic Objective To provide an overview of the topics that this section covers ! Group Activity: Displaying Member Information Lead-in ! Using MDX Functions ! CurrentMember Function ! Name Function ! Level Function In this section, you will learn how to use MDX functions from the Functions list and... CurrentMember function is extremely common in MDX expressions, but you often do not see it because it can often be omitted BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY 22 Module 3: Using MDX Expressions ! To omit the CurrentMember function for a dimension Delivery Tip DimensionNameD.txt in C:\MOC\2093A\Demo\D03\ Answers contains the completed MDX expression for this procedure In... constants Prerequisites Before working on this lab, you must have successfully completed modules 1 and 2 in course 2093A, Implementing Business Logic with MDX in Microsoft SQL Server™ 2000 Estimated time to complete this lab: 10 minutes BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY Module 3: Using MDX Expressions 13 Exercise 1 Creating a Constant Measure Delivery Tip The procedures... completed MDX expression used in this procedure 1 In the Value property, change the expression for the Constant Value member to display “Goodbye” What MDX expression did you use? “Goodbye” 2 Press ENTER, and then verify that the browser content is similar to the following table BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY Module 3: Using MDX Expressions. .. independently of the others In an MDX expression, you can use any standard arithmetic operator: • Plus sign (+) for addition • Minus sign (-) for subtraction • Asterisk (*) for multiplication • Slash mark (/) for division • Caret (^) for raising to a power (exponent) BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY Module 3: Using MDX Expressions 7 MDX does not do type conversions . Displaying Cube Metadata 46 Using Conditional Expressions 55 Lab C: Using Conditional Expressions 64 Review 68 Module 3: Using MDX Expressions BETA MATERIALS. conditional expressions. Module 3: Using MDX Expressions 1 BETA MATERIALS FOR MICROSOFT CERTIFIED TRAINER PREPARATION PURPOSES ONLY Overview ! Using MDX Expressions

Ngày đăng: 18/10/2013, 18:15

TỪ KHÓA LIÊN QUAN