Thursday, November 7, 2013

MDX basic concepts and syntax

In cube unique name for a member is dependent upon the dimension properties such as MemberUniqueNameStyle and HierarchyUniqueNameStyle. The algorithm is determining the unique name of members.


We can access members of a dimension using the name path (using name of the member) or the key path (using the key of the member).



We can access a member in a dimension with its dimension name, hierarchy name, and level name.


For example, member Q1 CY 2004 in the Calendar hierarchy is represented as:
[Date].[Calendar].[Calendar Quarter].[Q1 CY 2004]


The following three representations are also valid:
  • Hierarchy.Memeber name can be used whereas there are no two members with the same name. If Quarter name is called Q1 we can’t use this, because every year this Q1 repeats, so we should use level name.
                [Date].[Calendar].[Q1 CY 2004]


  • This is using all the members in the path.
            [Date].[Calendar].[CY 2004].[H1 CY 2004].[Q1 CY 2004]

  • Uses the key path.
            [Date].[Calendar].[Calendar Quarter].&[2004]&[1]

The keys of the members in a path represented as &[membername]. When we use the key path, the members are always preceded with the ampersand (&) symbol.
Ex: To access Canada member
[Customer].[Country].&[Canada]





Tuples: A tuple uniquely identifies a cell or a section of cube. A tuple is represented by one member from each dimension, separated by a comma, and is enclosed within parenthesis ().

For Example: Where Country=Australia AND Product=Mountain AND Period= Q1 CY 2004
([Date].[Calendar].[2004].[H1 CY 2004].[Q1 CY 2004], [Product].[Product Line].[Mountain],[Customer].[Country].[Australia])


A collection of tuples forms a new object called a set.


Set: An MDX set is a collection of tuples that are defined using the exact same set of dimensions, both in type and member. A set is specified within curly brace character ({ })
Ex: {(customer.Country.Australia),(Customer.Country.Canada)}

No comments:

Post a Comment