Multidimensional Expressions
From Wikipedia, the free encyclopedia
Multidimensional Expressions (MDX) is a query language for OLAP databases, much like SQL is a query language for relational databases. It is also a calculation language, with syntax similar to spreadsheet formulas.
Contents |
[edit] History
MDX was first introduced as part of the OLEDB for OLAP specification in 1997 from Microsoft (where it was invented by Mosha Pasumansky). The specification was quickly followed by commercial release of Microsoft OLAP Services 7.0 in 1998, and later by Microsoft Analysis Services. While it was not an open standard, but rather a Microsoft owned specification, it was adopted by the wide range of OLAP vendors, both servers - Applix, Microstrategy, SAS, SAP, Whitelight, NCR and clients - Panorama, Proclarity, AppSource, Cognos, Business Objects, Brio Technology, Crystal Reports, Microsoft Excel, etc. With the invention of XML for Analysis, which standardized MDX as a query language, even more companies such as Hyperion Solutions began supporting MDX.
[edit] mdXML
In 2001 the XMLA Council released the XML for Analysis standard, which included mdXML as a query language. In the current XMLA 1.1 specification, mdXML is essentially MDX wrapped in the XML <Statement>
tag.
[edit] MDX data types
There are six primary data types in MDX
[edit] Scalar
Scalar is either a number or a string. It can be specified as a literal, e.g. number 5 or string "OLAP" or it can be returned by an MDX function, e.g. Aggregate
(number), UniqueName
(string), .Value
(number or string) etc.
[edit] Hierarchy
Hierarchy is a dimension hierarchy of a cube. It can be specified by its unique name, e.g. [Time].[Fiscal]
or it can be returned by an MDX function, e.g. .Hierarchy
.
[edit] Level
Level is a level in a dimension hierarchy. It can be specified by its unique name, e.g. [Time].[Fiscal].[Month]
or it can be returned by an MDX function, e.g. .Level
.
[edit] Member
Member is a member in a dimension hierarchy. It can be specified by its unique name, e.g. [Time].[Fiscal].[Month].[August]
, by qualified name, e.g. [Time].[Fiscal].[2006].[Q2].[August]
or returned by an MDX function, e.g. .PrevMember
, .Parent
, .FirstChild
etc.
[edit] Tuple
Tuple is an ordered collection of one or more members from different hierarchies. Tuples can be specified enumerating the members, e.g. ([Time].[Fiscal].[Month].[August], [Customer].[By Geography].[All Customers].[USA], [Measures].[Sales])
or returned by an MDX function, e.g. .Item
.
[edit] Set
Set is an ordered collection of tuples with the same hierarchality (dimensionality). It can be specified enumerating the tuples, e.g. {([Measures].[Sales], [Time].[Fiscal].[2006]), ([Measures].[Sales], [Time].[Fiscal].[2007])}
or returned by MDX function or operator, e.g. Crossjoin
, Filter
, Order
, Descendants
etc.
[edit] Other data types
In limited contexts, MDX allows other data types as well - for example Array can be used inside the SetToArray
function, Dimension can be used inside Leaves
function etc. Objects of other data types are represented as scalar strings indicating the object names, such as measure group name in the MeasureGroupMeasures
function or KPI name in for example the KPIValue
or KPIGoal
functions.
[edit] Books
- George Spofford, Sivakumar Harinath, Chris Webb, Dylan Hai Huang, Francesco Civardi: MDX-Solutions: With Microsoft SQL Server Analysis Services 2005 and Hyperion Essbase. Wiley, 2006, ISBN 0-471-74808-0
- Mosha Pasumansky, Mark Whitehorn, Rob Zare: Fast Track to MDX. ISBN 1-84628-174-1