Thursday, February 10, 2011

Understand CUBE and it's Terms

Members, Tuples,Sets and Cell:
Members:
                
A member is an item in a dimension representing one or more occurrences of data. A member is the                               lowest level of reference when describing cell data in a cube.


The bracket characters, [ and ], are used if the name of a member has a space or a number in it. Although the Time dimension is one word, bracket characters can also be used around it as well.

The member shown in the above diagram could also be represented as:
[Time].[2nd half].[4th quarter] 


   
Member Names and Member Keys:
Member name:
A member can be referenced by either its member name or by its member key. The previous example referenced the member by its member name, "4th quarter", in the Time dimension. However, the member name can be duplicated.
Member Key:
An alternate method to reference members is by referencing the member key. The member key is used by the dimension to specifically identify a given member. 
The ampersand (&) character is used in MDX to differentiate a member key from a member name, as shown in the following example: "Q4" is the member Key.

[Time].[2nd half].&[Q4]
The ampersand character can be used to indicate a member key reference in any MDX expression.


Tupels:

A tuple is used to define a slice of data from a cube; it is composed of an ordered collection of one member from one or more dimensions. A tuple is used to identify specific sections of multidimensional data from a cube; a tuple composed of one member from each dimension in a cube completely describes a cell value. Put another way, a tuple is a vector of members; think of a tuple as one or more records in the underlying database whose value in these columns falls under these categories. A series of diagrams presents different types of tuples.

The shaded area of the cube represents the (Time.[2nd half]) tuple. Note that this tuple encompasses half of the cube, because it does not rule out any information in the Source or Route dimensions.

The following diagram below is shaded to represent the 
(Time.[2nd half], Route.nonground.air) tuple.

This tuple represents the cells at the intersection of these members.
In MDX, tuples are syntactically constructed depending upon their complexity.
 If a tuple is composed of only one member from a single dimension, often referred to as a simple tuple, the following syntax is acceptable.
Time.[2nd half]
If a tuple is composed of members from more than one dimension, the members represented by the tuple must be enclosed in parentheses, as demonstrated in the following example.
(Time.[2nd half], Route.nonground.air)
A tuple composed of a single member can also be enclosed in parentheses, but this is not required. Tuples are often grouped together in sets for use in MDX queries.
SETS:



A set is an ordered collection of zero, one or more tuples. A set is most commonly used to define axis and slicer dimensions in an MDX query, and as such may have only a single tuple or may be, in certain cases, empty. The following example shows a set of two tuples:


{ (Time.[1st half], Route.nonground.air), (Time.[2nd half], Route.nonground.sea) }

 A set can contain more than one occurrence of the same tuple. The following set is acceptable:

{ Time.[2nd half], Time.[2nd half] }

A set refers to either a set of member combinations, represented as tuples, or to the values in the cells that the tuples in the set represent, depending on the context of usage for the set.
In MDX syntax, tuples are enclosed in braces to construct a set.
Important  Sets composed of a single tuple are not tuples; they are interpreted as sets by MDX. Certain MDX functions accept tuples as parameters, and will raise an error if a single tuple set is passed.
The order of tuples in a set is important
Set Functions:

Explicitly typing tuples and enclosing them in braces is not the only way to retrieve a set. MDX supports a wide variety of functions that return sets.
The colon operator allows you to use the natural order of members to create a set. For example, the following set:
{[1st quarter]:[4th quarter]}                                           Note: (it behave like enum operator)
retrieves the same set of members as the following set:
{[1st quarter], [2nd quarter], [3rd quarter], [4th quarter]}

Other MDX functions that return sets can be used either by themselves or as part of a comma-delimited list of members. For example, all of the following MDX expressions are valid:
{Time.Children}
{Time.Children, Route.nonground.air}
{Time.Children, Route.nonground.air, Source.Children}


Sets and Dimensionality:

The order of tuples in a set is important; it affects, for example, the nesting order in an axis dimension. The first tuple represents the first, or outermost, dimension, the second tuple represents the next outermost dimension, and so on.


Cell:
A cell in a cube is the space that exists at the intersection of a member of the measures dimension member and a member from each attribute hierarchy in a cube.
·         A member from the measures dimension can be a leaf member (an individual fact) or an aggregated member (for example, sales aggregated for a particular year).
·         A member from a dimension can be the leaf member, a data member, a parent member, or an (All) member.

No comments:

Post a Comment