MDX (Multidimensional Expressions) is a query language for OLAP (Online Analytical Processing) databases, primarily used with Microsoft SQL Server Analysis Services (SSAS) and other multidimensional database systems. Unlike SQL's flat relational model, MDX navigates hierarchical cube structures with dimensions, measures, and complex aggregations. Its syntax resembles spreadsheet formulas and enables sophisticated time-based calculations, drill-down operations, and dynamic filtering across multiple dimensions—making it essential for business intelligence reporting and data analytics where users need to slice, dice, and pivot multidimensional data rapidly.
What This Cheat Sheet Covers
This topic spans 18 focused tables and 121 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Query Structure Basics
| Component | Example | Description |
|---|---|---|
SELECT [Measures].[Sales] ON COLUMNS, [Product].[Category].Members ON ROWSFROM [SalesCube] | • Core query syntax that specifies what to retrieve (axes), from which cube, and optional filtering • axes define result dimensions—COLUMNS for column headers, ROWS for row headers | |
FROM [SalesCube] | • Specifies the target cube or subcube to query • can reference a physical cube or a subselect expression that restricts cube space | |
WHERE ([Time].[2025], [Geography].[USA]) | • Filters the entire result set by specifying a tuple that forms the slicer axis • reduces cube dimensions globally—often called the filter axis | |
WITH MEMBER [Measures].[Profit] AS [Measures].[Sales] - [Measures].[Cost]SELECT ... | • Defines query-scoped calculated members or named sets before the SELECT statement • members/sets only exist within this query, not persisted to cube |