Multidimensional Expressions (MDX) is a query language for OLAP databases, much like SQL is a query language for relational databases.
History
MDX was first introduced as part of OLEDB for OLAP specification in 1997 from
Microsoft. 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, Cognos, Business Objects, Brio, Crystal, MicroStrategy etc.
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 XML
tag.
MDX Data Types
There are six primary data types in MDX
Scalar
Scalar is either a number or a string. It can be specified as a literal, i.e. number 5 or string "OLAP" or it can be returned by MDX function, i.e. Aggregate (number), UniqueName (string), .Value (number or string) etc.
Hierarchy
Hierarchy is a dimension hierarchy of a cube. It can be specified by its unique name, i.e. *.* or it can be returned by MDX function, i.e. .Hierarchy.
Level
Level is a level in dimension hierarchy. It can be specified by its unique name, i.e. *.*.* or it can be returned by MDX function, i.e. .Level.
Member
Member is a member in dimension hierarchy. It can be specified by its unique name, i.e. *.*.*," target="_blank" >by qualified name, i.e. *.*.*.* or returned by MDX function, i.e. .PrevMember, .Parent, .FirstChild etc.
Tuple
Tuple is an ordered collection of one or more members from different hierarchies. Tuples can be specified enumerating the members, i.e. (*.*.*," target="_blank" >Geography.Customers.*," target="_blank" >*)or returned by MDX function, i.e. .Item.
Set
Set is an ordered collection of tuples with the same hierarchality (dimensionality). It can be specified enumerating the tuples, i.e. {(*," target="_blank" >*.*)," target="_blank" >(*," target="_blank" >*.*)} or returned by MDX function or operator, i.e. Crossjoin, Filter, Order, Descendants etc.
Other data types
In limited contexts, MDX allows other data types as well - for example Array can be used inside 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 MeasureGroupMeasures function or KPI name in KPIValue, KPIGoal etc functions.
Books
- George Spofford: MDX-Solutions. Wiley, 2001, ISBN 0471400467
- Mosha Pasumansky, Mark Whitehorn, Rob Zare: Fast Track to MDX. ISBN 1846281741
External links
Query languages
Multidimensional Expressions | MDX