Presentation is loading. Please wait.

Presentation is loading. Please wait.

Event Title Event Date. Module 7 – Introduction to MDX Stacia Misner SQLSkills, BI Partner.

Similar presentations


Presentation on theme: "Event Title Event Date. Module 7 – Introduction to MDX Stacia Misner SQLSkills, BI Partner."— Presentation transcript:

1 Event Title Event Date

2

3 Module 7 – Introduction to MDX Stacia Misner SQLSkills, BI Partner

4 Disclaimer The information contained in this slide deck represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This slide deck is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this slide deck may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this slide deck. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this slide deck does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place or event is intended or should be inferred. © 2008 Microsoft Corporation. All rights reserved. Microsoft, SQL Server, Office System, Visual Studio, SharePoint Server, Office PerformancePoint Server,.NET Framework, ProClarity Desktop Professional are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. 4

5 Where Are We? Data Sources Staging Area Manual Cleansing Data Marts Data Warehouse Client Access 5

6 Module Overview Introducing MDX Understanding Query Statements Exploring MDX Query Techniques Working with MDX Formulas Adding Calculations to the MDX Script Using Stored Procedures 6

7 Introducing MDX Defining MDX Using MDX Learning MDX 7

8 Defining MDX Multi-Dimensional eXpression Specifications −OLEDB for OLAP −XML/A Designed multi-dimensional reporting and analysis 8

9 Using MDX Query Statements −Source for reports (similar to SQL) Formulas −Values for cells (similar to Excel) Management Functions −Alter Cube, Update Cube, etc. 9

10 MDX MDX and UDM BI Application Application Data Source OLAPBrowser ReportingTool XML/A or ODBO DWUDM AnalysisServices Cache 10 MDX

11 Learning MDX MDX Query Statements −SQL skills helpful MDX Formulas −Excel skills helpful Different from rendering skills −C#, ASP.Net not particularly hepful 11

12 Understanding Query Statements Introducing MDX Query Structure Comparing T-SQL and MDX Query Structures Comparing T-SQL and MDX Concepts 12

13 Introducing MDX Query Structure SELECT On Columns, On Rows FROM | WHERE Dicers Slicer

14 Comparing T-SQL and MDX Query Structures T-SQL Define columns Query populates rows Row headings are data Data dynamically aggregated for groups MDX Define rows and columns Query populates cells Row headings are schema Data referenced by cell sets 14

15 1 T-SQL versus MDX Concepts

16 Comparing T-SQL and MDX Concepts SQL Queries Metadata (joins and aliases) must be included in view Group and Summarize Rows −Non-existent rows don’t appear by default −Outer Join can show rows with missing data Sort, Group, Filter once for whole query Expressions can consider only current row MDX Queries Metadata is predefined in the cube (UDM) definition Build Axes and Fill Values −All axis members do appear by default −NON EMPTY can drop results with missing data Sort, Group, Filter independently for each set Expressions can consider any point (e.g., prior month) 16

17 Exploring MDX Query Techniques Defining an Axis Creating a Set Manipulating Sets Using Functions and Keywords on the Axis Defining an Asymmetrical Query Using the CELL PROPERTIES Clause

18 2 MDX Query Fundamentals

19 Defining an Axis ON −Columns0 −Rows1 NON EMPTY to avoid blank rows/columns SELECT NON EMPTY [Measures].Members ON 0, NON EMPTY [Category].Members ON Rows FROM [Adventure Works]; 19

20 Creating a Set.Members (of Hierarchy or Level) −Descendants or Children in User hierarchy Explicit members in braces −{[Sales Amount],[Order Quantity]} −Single member set doesn’t need braces SELECT [Sales Amount] ON 0, [Category].Members ON Rows FROM [Adventure Works]; 20

21 Manipulating Sets Order Head TopCount Filter (in query, use subcube query to filter) Crossjoin (in some cases, use subcube) Generate 21

22 Examples of Set Functions Top 10 Customers TopCount([Customer],10, [Sales Amount]) Declining Customers Except( TopCount([Customer]),10, ([Prior Year Sales]), TopCount([Customers]),10, (Current Year Sales]) )

23 Using Functions and Keywords on the Axis 23 Use thisTo do this HierarchizeTo force the default dimension sort order NON EMPTYTo eliminate empty rows (or columns) DIMENSION PROPERTIES MEMBER_CAPTION To retrieve captions NON EMPTY Hierarchize(«set») DIMENSION PROPERTIES MEMBER_CAPTION ON Columns

24 Defining an Asymmetrical Query CY 2004CY 2005 Sales Amount Order Quantity Use explicit tuples in sets Use same “hierarchality” in each tuple {([CY 2004],[Sales Amount]), ([CY 2005],[Sales Amount]), ([CY 2005],[Order Quantity])} 24 Some OLAP browsers don’t support asymmetrical queries

25 Using the Cell Properties Clause Include the clause to retrieve formatted value, colors, etc. Add the clause at the end of the SELECT statement SELECT [Measures].[Sales Amount] On Columns FROM [Adventure Works] CELL PROPERTIES Formatted_Value; 25

26 Working with MDX Formulas Using Multidimensional Coordinates Defining a Tuple Understanding Calculation Behavior Creating Calculations Reviewing Formula Examples 26

27 Using Multidimensional Coordinates Geometry 3 012345 [February] 27 Cube One Dimension – One Coordinate

28 Comma and parentheses Two Dimensions — Double Coordinate 0 1 2 3 4 5 12345 0 ([January], [Sphinx Bagels]) Geometry (3, 4) Order doesn’t matter 28 Cube

29 Three Dimensions — Triple Coordinate (4, 2, 3) 4 1 2 3 1 2 3 0 1 2 3 4 5 4 5 1 2 3 1 2 3 0 1 2 3 4 5 4 5 Geometry ([Washington], [January], [Sphinx Bagels]) 29 Cube

30 Multidimensional Coordinate Terminology 4 Dimensions — Quadruple Coordinate 5 Dimensions — Quintuple Coordinate 6 Dimensions — Sextuple Coordinate 7 Dimensions — Septuple Coordinate Generic Term — Tuple ([Sales Units], [Bread], [USA], [1998]) Tuple: A list of members from different hierarchies separated by commas and enclosed in parentheses 30

31 Defining a Tuple A Tuple is a multidimensional cell coordinate −At most one member from a hierarchy −Order of members does not matter −If more than one hierarchy − Separate members with commas − Enclose tuple in parentheses How Do You Pronounce Tuple? −Too-ple (like quadruple) −Tup-ple (like quintuple) 31

32 Every Cell Has a Name All Product Bread Dairy Meat Units Dollars (Bread, USA, Units) ([All Product], [All State], Dollars) (Meat, Mexico, Dollars) USA Canada Mexico All State 32

33 Complete and Partial Tuples Complete Tuple −One member from each attribute hierarchy −Required to retrieve a value Partial Tuple −Omits some attribute hierarchies −May have as few as one attribute hierarchy Omitted hierarchies in Partial Tuple Use Current Member Current Member Defined by −Row/column axes −Slicer definition −Default member 33

34 Tuples and Unspecified Hierarchies Unspecified attribute hierarchies use the current member ([Order Quantity]) ([Reseller Name].CurrentMember, [Sales Person Hierarchy].CurrentMember [Order Date].[Calendar Year].CurrentMember, [Product Cateogry].CurrentMember, [Order Quantity]) ([Reseller Name].CurrentMember, [Sales Person Hierarchy].CurrentMember [Order Date].[Calendar Year].CurrentMember, [Product Cateogry].CurrentMember, [Order Quantity]) 34

35 Tuples and Regular Cells Tuple Comes from Row, Column, and Filter ([Accessories], [2002], [A Bike Store], [Jiang,Stephen], [Order Quantity]) ([Accessories], [2002], [A Bike Store], [Jiang,Stephen], [Order Quantity]) 35

36 Specifying a Member in a Tuple Constant −[Sales Amount] Current Member −Typically omit Function of Current Member −[Date].CurrentMember.PrevMember 36

37 Understanding Calculation Behavior Calculated Members −New members added to a hierarchy at run time Scripts −Replace the values that would otherwise be in part of a cube −Appear to be procedural, but really define state formulas All calculations are ‘pull’ not ‘push’ Results of calculations may be cached, but not persisted 37

38 Creating Calculations Tuple based −Average Price = [Sales Amount] / [Order Quantity] −Like Excel references: =B5/B4 Set based −Year To Date = Sum((PeriodsToDate([Order Date].[Calendar Quarter]),[Order Quantity]) −Like Excel ranges: =Sum(B2:B10) 38

39 Cell References and Tuples =$B4/$B$2 Only two dimensions Based on location Cryptic relative/absolute Multiple copies of formula [Sales Amount] / ([Sales Amount],[Product].[All]) Arbitrary number of dimensions Based on names or keys Relative simply omitted One formula applies to all cells 39

40 Reviewing Formula Examples Percent of Parent PrevMember Function ParallelPeriod Function 40

41 [All State], Units)/ [Product].CurrentMember.Parent) Explicit Member Percent of Parent Current Member All Product Bread Dairy Meat USA Canada Mexico All State Units Dollars Function of Current Member ([Bread],([Product].CurrentMember, 41 [All State], [Units])

42 PrevMember Function Returns previous member on same level Can be used with any hierarchy, but is typically used with time hierarchy Assumes sequential importance Does not require user hierarchy Date.Calendar.CurrentMember.PrevMember Returns [2008].[Qtr 2].[Apr] if May 2008 is the Current Member 42

43 ParallelPeriod Function Finds corresponding member of common ancestor Defaults to base from time current member With Level argument, controls common ancestor Only meaningful in User hierarchy ParallelPeriod() Returns [2008].[Qtr 1].[Feb] if May 2008 is the Current Member 43

44 44

45 © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Download ppt "Event Title Event Date. Module 7 – Introduction to MDX Stacia Misner SQLSkills, BI Partner."

Similar presentations


Ads by Google