Your SlideShare is downloading. ×
  • Like
Mdx 2nddraft
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply
Published

 

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,214
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
166
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • MoshaPasumansky, a former Panorama developer who is credited with being the primary author of the language

Transcript

  • 1. MDX LanguageAn Overview
    Presented by:
    Muhammad Saleh AL-Qurishi FatoohAL-Qershi
  • 2. Agenda
    Introduction
    Brief History
    SQL vs. MDX
    MDX Language
    MDX syntax
    Naming conventions
    Tuples and sets
    How MDX is used
    MDX queries
    Using MDX for queries
    SELECT, FROM, ON COLUMNS, ON ROWS
    WHERE
    MDX expression
    References
    2
    12/30/2009
    MDX Solution Presentation By-Muhammad & Fatooh
  • 3. MDX Solution Presentation By-Muhammad & Fatooh
    3
    12/30/2009
    Introduction
  • 4. Brief History
    MDX Solution Presentation By-Muhammad & Fatooh
    4
    12/30/2009
    When first conceived of by Panorama Software in the mid-1990s, MDX was an extension of SQL.
    Its original name was Multi-Dimensional eXtensions,
    (says MoshaPasumansky)
    In less than a decade, the programming language MDX has become the de facto standard for reporting and analysis in business intelligence (BI) systems
    It is supported by virtually every major vendor of BI servers, including Microsoft, SSAS, IBM, Hyperion, and SAP
  • 5. Why has MDX become so popular
    The growth of the BI industry it self.
    Users need fast and intuitive access to company information to make more profitable business decisions
    It is uniquely able to navigate, query, and perform calculations against multidimensional structures
    MDX Solution Presentation By-Muhammad & Fatooh
    5
    12/30/2009
  • 6. How MDX Differs from SQL?
    MDX Solution Presentation By-Muhammad & Fatooh
    6
    12/30/2009
  • 7. SQL Does Things that MDX Can’t
    MDX Solution Presentation By-Muhammad & Fatooh
    7
    12/30/2009
  • 8. MDX Language
    MDX Solution Presentation By-Muhammad & Fatooh
    8
    12/30/2009
  • 9. What Is MDX?
    MDX is a language that
    Expresses selections, calculations, and some metadata definitions against an Online Analytical Processing (OLAP) database
    Provides some capabilities for specifying how query results are to be represented
    Is not a full report-formatting language
    There are several different APIs that support MDX
    OLE DB for OLAP, ADO MD, ADOMD.Net, XMLA
    MDX Solution Presentation By-Muhammad & Fatooh
    9
    12/30/2009
  • 10. MDX – Basic Terminology
    Cube – is a subset of data from the OLAP store, organized and summarized into multidimensional structures
    Cell – One or more facts (measures) and dimension attributes that represent one record in a cube
    Dimension – business factor used to group a fact record
    Hierarchy – Levels of aggregation in a dimension
    Level – Aggregation layer in a dimension hierarchy
    Member – value of a dimension attribute or a derived value from a dimension attribute
    Measure – Fact. Numerical value that measures a business activity and can be summarized
    MDX Solution Presentation By-Muhammad & Fatooh
    10
    12/30/2009
  • 11. Naming Conventions
    MDX Solution Presentation By-Muhammad & Fatooh
    11
    12/30/2009
    Working with the Store dimension shown in the diagram above, we’d indicate the Leominster member like this:
    [Store].[All].[Massachusetts].[Leominster]
    [Store].Leominster] with certain data and certain naming conventions
    if we have a hierarchy of Time we can’t use [Time].[Oct]because we may have more than one October in different years. But we can use [Time].[June,2001] rather than [Time].[All].[2001].[Q2].[June]
  • 12. Tuples and Sets
    A tuple is a combination of members from different dimensions
    Essentially a multidimensional member
    A single member is a simple tuple
    ([Time].[Jun, 2005]) simple tuple (one dimension)
    ([Customer].[Chicago, IL], [Time].[Jan, 2005]) tuple with two dimensions
    Each member in the tuple has to be from a different dimension
    E.g. tuple should not have two Time members
    We can’t compose an empty tuple
    We can’t use syntax to compose a tuple from tuples
    MDX Solution Presentation By-Muhammad & Fatooh
    12
    12/30/2009
  • 13. Tuples and Sets(cont.)
    A set is simply an ordered collection of tuples
    Sets are typically enclosed by curled "{ }" braces
    Specify the cells of a cube that are to be returned by the query
    Often appear in the SELECT part of a query
    MDX Solution Presentation By-Muhammad & Fatooh
    13
    12/30/2009
    SELECT
    { ( [Time].[2005], [Measures].[Dollar Sales] ),
    ( [Time].[Feb, 2005], [Measures].[Unit Sales] )
    }
    ON COLUMNS ,
    { [Product].[Tools], [Product].[Toys] } ON ROWS
    FROM [Sales]
  • 14. Brackets, braces and the odd dot and comma
    MDX Solution Presentation By-Muhammad & Fatooh
    14
    12/30/2009
  • 15. Question 1
    MDX Solution Presentation By-Muhammad & Fatooh
    15
    12/30/2009
    Is the following a tuple or a set?
    ([Time].[May], [Store].[Boston], [Product].[Anchovies])
    Answer: ?
  • 16. Question 2
    OK, now what about these two?
    1- ([Store].[Boston], [Product].[Anchovies])
    2- {([Time].[April], [Store].[Boston], [Product].[Anchovies]),
    ([Time].[May], [Store].[Boston], [Product].[Anchovies]),
    ([Time].[June], [Store].[Boston], [Product].[Anchovies]),
    ([Time].[July], [Store].[Boston], [Product].[Anchovies])}
    Answer:?
    MDX Solution Presentation By-Muhammad & Fatooh
    16
    12/30/2009
  • 17. How MDX is used
    MDX Solution Presentation By-Muhammad & Fatooh
    17
    12/30/2009
  • 18. MDX Query Syntax
    SELECT
    {set defining the column headers}
    ON COLUMNS,
    {set defining the row headers}
    ON ROWS
    FROM [cube name]
    WHERE [Slicer specification]
    MDX Solution Presentation By-Muhammad & Fatooh
    18
    12/30/2009
    MDX is neither case-sensitive nor line-oriented
  • 19. MDX Query Syntax(cont.)
    MDX Solution Presentation By-Muhammad & Fatooh
    19
    12/30/2009
    The SELECT keyword starts the clause that specifies what you want to retrieve
    The ON keyword is used with an axis name to specify where dimensions from our database are displayed
    If you desire more generic axis terms over the named terms, you can use the AXIS(index) naming convention
    The phrase on axis(n) indicates that those members should be put on the axis numbered n.
    A query that uses axis 1 must also use axis 0, and a query that uses axis 2 must also use axes 1 and 0
  • 20. Query example
    MDX Solution Presentation By-Muhammad & Fatooh
    20
    12/30/2009
    Look at a grid of numbers that has the Massachusetts sales and costs for the first two quarters of 2005
    SELECT
    { [Measures].[Dollar Sales], [Measures].[Unit Sales] }
    ON columns,
    { [Time].[Q1, 2005], [Time].[Q2, 2005] }
    ON rows
    FROM [Sales]
  • 21. Slicer Clause (WHERE clause)
    WHERE clause is actually optional
    It is used to define the measure that is being queried
    It can, and often does, extend to other dimensions
    WHERE (Measures.[Sales Average], [Time].[Year].[1997])
    It is not the same as filtering (such as SQL)
    Slicing does not affect selection of the axis members, but rather the values that go into them
    Filtering reduces the number of axis members
    MDX Solution Presentation By-Muhammad & Fatooh
    21
    12/30/2009
  • 22. Five main execution stages after the query is successfully parsed:
    1- Resolving the FROM clause
    2- Resolving the WHERE clause
    3- Resolving named sets in the WITH clause
    4- Resolving the tuples on each axis
    5- Calculating the cells brought back in the axis intersections
    a. Resolving NON EMPTY intersections
    b. (AS2005) Resolving the HAVING clause on each axis
    22
    12/30/2009
    MDX Solution Presentation By-Muhammad & Fatooh
    The Execution Stages of a Query
  • 23. MDX Expression
    MDX Solution Presentation By-Muhammad & Fatooh
    23
    12/30/2009
  • 24. Calculated Member
    The core syntax for defining a calculated member on a dimension is
    MEMBER MemberIdentifier AS ‘member-formula’ [, properties...]
    The three main parts are:
    Member identifier, which specifies the name, dimension and hierarchical positioning of the calculated member
    Formula, which specifies how the calculated member’s results are derived
    Optional properties, which can provide additional calculation, display, and other kinds of information
    MDX Solution Presentation By-Muhammad & Fatooh
    24
    12/30/2009
  • 25. Calculated Member(cont.)
    Calculated Member in the WITH section of a query will not visible outside of the query.
    If we use CREATE SET command, then it will be available to more than one query
    We can drop it with the DROP SET command
    MDX Solution Presentation By-Muhammad & Fatooh
    25
    12/30/2009
  • 26. Calculated Member(WITH Section)
    MDX Solution Presentation By-Muhammad & Fatooh
    26
    12/30/2009
  • 27. Calculated Member(more than one dimension)
    MDX Solution Presentation By-Muhammad & Fatooh
    27
    12/30/2009
  • 28. Named Set
    The basic syntax for defining a named set that is supported by most vendors is as follows:
    SETSet-Identifier AS ‘set-formula’
    Named set in the WITH part of a query will not visible outside of the query.
    If we use CREATE SET command, then it will be available to more than one query
    We can drop it with the DROP SET command
    MDX Solution Presentation By-Muhammad & Fatooh
    28
    12/30/2009
  • 29. Named set using WITH clause
    MDX Solution Presentation By-Muhammad & Fatooh
    29
    12/30/2009
  • 30. Named set using CREAT SET
    MDX Solution Presentation By-Muhammad & Fatooh
    30
    12/30/2009
    Analysis Services 2005
    Essbase V9
  • 31. Common Functions
    MDX Solution Presentation By-Muhammad & Fatooh
    31
    12/30/2009
  • 32. .MEMBER
    The simplest form of an axis specification or member selection involves taking the MEMBERS of the required dimension
    Returns set of all members
    MDX Solution Presentation By-Muhammad & Fatooh
    32
    12/30/2009
    SELECT Measures.MEMBERS
    ON COLUMNS,
    [Store].MEMBERS
    ON ROWS
    FROM [Sales]
    SELECT Measures.MEMBERS ON COLUMNS,
    {[Store].[Store State].[CA], [Store].[Store State].[WA]} ON ROWS
    FROM [Sales]
  • 33. . CHILDREN
    Returns the set of all members of the level immediately beneath the starting level
    Returns the child members for a particular member within the dimension
    MDX Solution Presentation By-Muhammad & Fatooh
    33
    12/30/2009
    SELECT Measures.MEMBERS
    ON COLUMNS,
    {[Store].[Store State].[CA].CHILDREN,
    [Store].[Store State].[WA].CHILDREN}
    ON ROWS
    FROM [Sales]
  • 34. Both MEMBER & CHILDREN functions are used often in formulating expressions, but do not provide the ability to drill down to a lower level within the hierarchy
    MDX Solution Presentation By-Muhammad & Fatooh
    34
    12/30/2009
    For this task, a function called DESCENDANTS is required
    This function allows one to go to any level in depth
  • 35. Descendants()
    MDX Solution Presentation By-Muhammad & Fatooh
    35
    12/30/2009
    The syntax for the DESCENDANTS function is:
    DESCENDANTS(member, level [, flags])
    The expression:
    Descendants( [Time].[1998],[Month])
    would return all twelve months 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12 (that is, all the descendants of 1998 at the month level)
    And:
    Descendants( [Time].[1998].[Q2],[Month])
    would return all the descendants of Q2 at the month level, namely 4, 5 and 6
  • 36. CrossJoin()
    CrossJoin() –cross-product of members or tuples in two different sets
    Specify all possible combinations
    Syntax: CrossJoin (set1, set2)
    MDX Solution Presentation By-Muhammad & Fatooh
    36
    12/30/2009
  • 37. Filter()
    Reduce a set by including in the resulting set only those elements that meet some criteria
    Arguments
    Boolean Expression
    Set
    Returns subset
    The syntax for Filter() is:
    Filter (set, Boolean-expression)
    For example, the expression
    Filter (
    { [Product].[Product Category].Members },
    [Measures].[Dollar Sales] >= 500
    )
    MDX Solution Presentation By-Muhammad & Fatooh
    37
    12/30/2009
  • 38. Order()
    To put the tuples in a set into a sequence based on associated data values
    The syntax for the Order() function
    Order (set1, expression [, ASC | DESC | BASC | BDESC])
    Arguments
    Ordering criterion
    Set
    Flag option (ex. Ascending, descending)
    Hierarchical order can be complex
    MDX Solution Presentation By-Muhammad & Fatooh
    38
    12/30/2009
  • 39. Order() Example
    Given the set of product categories , we may want to sort them in descending order by sales. A very simple query for this may look like the following;
    MDX Solution Presentation By-Muhammad & Fatooh
    39
    12/30/2009
  • 40. NON EMPTY
    Removing empty slices from query results
    Works on any axis, and with any dimensions and tuples
    MDX Solution Presentation By-Muhammad & Fatooh
    40
    12/30/2009
  • 41. NON EMPTY
    MDX Solution Presentation By-Muhammad & Fatooh
    41
    12/30/2009
    Query with empty slices on rows
    Empty slices removed with NON EMPTY
  • 42. References
    MDX Solutions, Second Edition: With Microsoft® SQL Server™ Analysis Services 2005 and Hyperion® Essbase
    Fast Track to MDX by Mark Whitehorn, Robert Zare and MoshaPasumansky
    MDX language reference
    http://msdn.microsoft.com/en-us/library/ms145506.aspx
    http://www.databasejournal.com/article.php/1459531
    MDX Solution Presentation By-Muhammad & Fatooh
    42
    12/30/2009
  • 43. Thanks
    ?
    43
    MDX Solution Presentation By-Muhammad & Fatooh
    12/30/2009