MDX (multi-dimensional expressions) is a language developed by Microsoft for queries using multi-dimensional data. An MDX expression returns a multi-dimensional result set (dataset) that consists of axis data and cell data.
The syntax of multi-dimensional expressions is defined in the Microsoft specification OLE DB for OLAP.
The following table gives an overview of the most important components of MDX statements:
MDX Component |
Significance |
FROM |
Cube selection |
SELECT ON COLUMNS |
Axes definition Definition of column axes |
WHERE |
Filter conditions definition |
The following example of a MDX request contains the above elements:
SELECT
{ [Measures].[CKF_SI_PROFIT],
[Measures].[0D_DOCUMENT],
[Measures].[0D_OORVALSC]
} ON COLUMNS,
NON EMPTY
[0D_PLANT].MEMBERS
ON ROWS
FROM [0D_SD_C03/SAP_DEMO_OLEDB]
WHERE
( [0CALMONTH].[200101],
[0D_COUNTRY].[US] )
The following graphic shows this example and the result:
Examples for basic modules
Entity |
Example |
Member (characteristic value) |
[City].[Las Vegas], [Time].[Year].[2003] |
Tuple (several characteristic values, various characteristics) |
([City].[Las Vegas],[Time].[Year].[2003],[Event].[SAP TechEd 2003]) |
Set (several tuples or member) |
{([City].[Los Angeles],[Time].[Year].[2002]),([City].[Las Vegas],[Time].[Year].[2003]),} |
Value (number, characters) |
5, “red” |
Examples for expressions that generate the entities named above
Expression |
Example |
Member as result |
<member>.PARENT |
Set as result |
TOPCOUNT(<set>,<index>,<numeric_value_expression>) |
Number as result |
MAX(<set>[, <numeric_value_expression>]) |