Databases Reference
In-Depth Information
Operators
The MDX language, similar to other query languages such as SQL or program-
ming languages, has several operators. An operator is a function that is used
to perform a specific action and takes arguments. MDX has several types of
operators. Similar to other languages, MDX contains the arithmetic operators,
logical operators, and special MDX operators.
Arithmetic Operators
Regular arithmetic operators such as +, , *, and / are part of the MDX arith-
metic operators. Just as with programming languages, these operators can be
applied between two numbers. The + and operators can also be used as un-
ary operators for numbers. Unary operator means the operator can be used
with a single operand (single number) in MDX expressions such as + 100 or
100.
Set Operators
The +, , and * operators, in addition to being arithmetic operators, are also
used to perform operations on the MDX Sets. The + operator is used to union
two Sets, the operator is used to evaluate the difference of two Sets, and the
* operator is used find the cross product of two sets. Cross product of two sets
results in all possible combinations of the tuples in each set and helps in re-
trieving data in a matrix format. For example if you have the two sets {Male,
Female} and {2003, 2004, 2005} then the cross product of the two sets repres-
ented as {Male, Female} * {2003, 2004, 2005} is {(Male,2003), (Male,2004),
(Male,2005),(Female,2003),(Female,2004),(Female,2005)}. The following ex-
amples show some of the operations on sets using the set operators.
Example 1
The result of the MDX expression
{[Customer].[Country].[Australia]} +
{[Customer].[Country].[Canada]}
Search WWH ::




Custom Search