HOME

TheInfoList



OR:

Multidimensional Expressions (MDX) is a
query language A query language, also known as data query language or database query language (DQL), is a computer language used to make queries in databases and information systems. In database systems, query languages rely on strict theory to retrieve informa ...
for
online analytical processing In computing, online analytical processing (OLAP) (), is an approach to quickly answer multi-dimensional analytical (MDA) queries. The term ''OLAP'' was created as a slight modification of the traditional database term online transaction proces ...
(OLAP) using a
database management system In computing, a database is an organized collection of data or a type of data store based on the use of a database management system (DBMS), the software that interacts with end users, applications, and the database itself to capture and an ...
. Much like
SQL Structured Query Language (SQL) (pronounced ''S-Q-L''; or alternatively as "sequel") is a domain-specific language used to manage data, especially in a relational database management system (RDBMS). It is particularly useful in handling s ...
, it is a query language for
OLAP cube An OLAP cube is a multi-dimensional array of data. Online analytical processing (OLAP) is a computer-based technique of analyzing data to look for insights. The term ''cube'' here refers to a multi-dimensional dataset, which is also sometimes cal ...
s. It is also a calculation language, with syntax similar to spreadsheet formulae.


Background

The MultiDimensional eXpressions (MDX) language provides a specialized syntax for querying and manipulating the multidimensional data stored in
OLAP cube An OLAP cube is a multi-dimensional array of data. Online analytical processing (OLAP) is a computer-based technique of analyzing data to look for insights. The term ''cube'' here refers to a multi-dimensional dataset, which is also sometimes cal ...
s. While it is possible to translate some of these into traditional SQL, it would frequently require the synthesis of clumsy SQL expressions even for very simple MDX expressions. MDX has been embraced by a wide majority of OLAP vendors and has become the standard for OLAP systems.


History

MDX was first introduced as part of the
OLE DB for OLAP OLE DB for OLAP (Object Linking and Embedding Database for Online Analytical Processing abbreviated ODBO) is a Microsoft published specification and an industry standard for multi-dimensional data processing. ODBO is the standard application progra ...
specification in 1997 from
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
. It was invented by the group of SQL Server engineers including Mosha Pasumansky. The specification was quickly followed by commercial release of Microsoft OLAP Services 7.0 in 1998 and later by Microsoft Analysis Services. The latest version of the
OLE DB for OLAP OLE DB for OLAP (Object Linking and Embedding Database for Online Analytical Processing abbreviated ODBO) is a Microsoft published specification and an industry standard for multi-dimensional data processing. ODBO is the standard application progra ...
specification was issued by Microsoft in 1999. While it was not an open standard, but rather a Microsoft-owned specification, it was adopted by a wide range of OLAP vendors. The XML for Analysis specification referred back to the OLE DB for OLAP specification for details on the MDX Query Language. In Analysis Services 2005, Microsoft added some MDX Query Language extensions like subselects. Products like Microsoft Excel 2007 started to use these new MDX Query Language extensions. Some refer to this newer variant of MDX as MDX 2005.


mdXML

In 2001 the XMLA Council released the
XML for Analysis XML for Analysis (XMLA) is an industry standard for data access in analytical systems, such as online analytical processing (OLAP) and data mining. XMLA is based on other industry standards such as XML, SOAP and HTTP. XMLA is maintained by XMLA Coun ...
(XMLA) standard, which included mdXML as a query language. In the XMLA 1.1 specification, mdXML is essentially MDX wrapped in the XML tag.


MDX data types

There are six primary
data type In computer science and computer programming, a data type (or simply type) is a collection or grouping of data values, usually specified by a set of possible values, a set of allowed operations on these values, and/or a representation of these ...
s in MDX * Scalar. Scalar is either a
number A number is a mathematical object used to count, measure, and label. The most basic examples are the natural numbers 1, 2, 3, 4, and so forth. Numbers can be represented in language with number words. More universally, individual numbers can ...
or a
string String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * ''Strings'' (1991 film), a Canadian anim ...
. 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. * Dimension/Hierarchy. Dimension is a
dimension In physics and mathematics, the dimension of a mathematical space (or object) is informally defined as the minimum number of coordinates needed to specify any point within it. Thus, a line has a dimension of one (1D) because only one coo ...
of a
cube A cube or regular hexahedron is a three-dimensional space, three-dimensional solid object in geometry, which is bounded by six congruent square (geometry), square faces, a type of polyhedron. It has twelve congruent edges and eight vertices. It i ...
. A dimension is a primary organizer of measure and attribute information in a cube. MDX does not know of, nor does it assume any, dependencies between dimensions - they are assumed to be mutually independent. A dimension will contain some members (see below) organized in some hierarchy or hierarchies containing levels. It can be specified by its unique name, e.g. ime/code> or it can be returned by an MDX function, e.g. .Dimension. Hierarchy is a
dimension In physics and mathematics, the dimension of a mathematical space (or object) is informally defined as the minimum number of coordinates needed to specify any point within it. Thus, a line has a dimension of one (1D) because only one coo ...
hierarchy A hierarchy (from Ancient Greek, Greek: , from , 'president of sacred rites') is an arrangement of items (objects, names, values, categories, etc.) that are represented as being "above", "below", or "at the same level as" one another. Hierarchy ...
of a
cube A cube or regular hexahedron is a three-dimensional space, three-dimensional solid object in geometry, which is bounded by six congruent square (geometry), square faces, a type of polyhedron. It has twelve congruent edges and eight vertices. It i ...
. It can be specified by its unique name, e.g. ime iscal/code> or it can be returned by an MDX function, e.g. .Hierarchy. Hierarchies are contained within dimensions. (''OLEDB for OLAP MDX specification does not distinguish between dimension and hierarchy data types. Some implementations, such as Microsoft Analysis Services, treat them differently.'') * Level. Level is a
level Level or levels may refer to: Engineering *Level (optical instrument), a device used to measure true horizontal or relative heights * Spirit level or bubble level, an instrument designed to indicate whether a surface is horizontal or vertical *C ...
in a dimension hierarchy. It can be specified by its unique name, e.g. ime iscal onth/code> or it can be returned by an MDX function, e.g. .Level. * Member. Member is a member in a dimension hierarchy. It can be specified by its unique name, e.g. ime iscal onth ugust 2006/code>, by qualified name, e.g. ime iscal
006 Alec Trevelyan is a fictional character who is the main antagonist in the 1995 James Bond film ''GoldenEye,'' portrayed by actor Sean Bean. Bean's likeness was also used as the model for Alec Trevelyan in the 1997 video game '' GoldenEye 007' ...
3 ugust 2006/code> or returned by an MDX function, e.g. .PrevMember, .Parent, .FirstChild etc. Note that all members are specific to a hierarchy. If the self-same product is a member of two different hierarchies ( roduct yManufacturer/code> and roduct yCategory/code>), there will be two different members visible that may need to be coordinated in sets and tuples (see below). * Tuple. Tuple is an ordered collection of one or more members from different dimensions. Tuples can be specified by enumerating the members, e.g. ( ime iscal onth ugust ustomer y Geography ll Customers SA easures ales or returned by an MDX function, e.g. .Item. * Set. Set is an ordered collection of tuples with the same dimensionality, or hierarchality in the case of Microsoft's implementation. It can be specified enumerating the tuples, e.g. or returned by MDX function or operator, e.g. Crossjoin, Filter, Order, Descendants etc. * Other data types. Member properties are equivalent to ''attributes'' in the data warehouse sense. They can be retrieved by name in a query through an axis PROPERTIES clause of a query. The scalar data value of a member property for some member can be accessed in an expression through MDX, either by naming the property (for example, roductCurrentMember. ales Price/code>) or by using a special access function (for example, roductCurrentMember.Properties("Sales Price")). In limited contexts, MDX allows other data types as well - for example Array can be used inside the SetToArray function to specify an array that is not processed by MDX but passed to a user-defined function in an ActiveX library. Objects of other data types are represented as scalar strings indicating the object names, such as measure group name in Microsoft's MeasureGroupMeasures function or KPI name in for example Microsoft's KPIValue or KPIGoal functions.


Example query

The following example, adapted from the SQL Server 2000 Books Online, shows a basic MDX query that uses the SELECT statement. This query returns a result set that contains the 2002 and 2003 store sales amounts for stores in the state of California. SELECT ON COLUMNS, ON ROWS FROM Sales WHERE ( tore SA A) In this example, the query defines the following result set information * The SELECT clause sets the query axes as the Store Sales member of the Measures dimension, and the 2002 and 2003 members of the Date dimension. * The FROM clause indicates that the data source is the Sales cube. * The WHERE clause defines the "slicer axis" as the California member of the Store dimension. Note: You can specify up to 128 query axes in an MDX query. If you create two axes, one must be the column axis and one must be the row axis, although it doesn't matter in which order they appear within the query. If you create a query that has only one axis, it must be the column axis. The square brackets around the particular object identifier are optional as long as the object identifier is not one of the reserved words and does not otherwise contain any characters other than letters, numbers or underscores. SELECT easures tore SalesON COLUMNS, ateMembers ON ROWS FROM Sales WHERE ( tore SA A)


References


Further reading

* 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, * Mosha Pasumansky, Mark Whitehorn, Rob Zare: ''Fast Track to MDX''. * Larry Sackett: ''MDX Reporting and Analytics with SAP NetWeaver BW''. SAP Press, 2008, 978-1-59229-249-3


External links


Multidimensional Expressions (MDX) Reference
from
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
Docs {{Authority control Online analytical processing Query languages