This section explains the basic structure of MDX query statements with a simple example.
The following MDX query for turnover data from 2020 to 2022.
select
{ [Date].[ALL].[2020], [Date].[ALL].[2021], [Date].[ALL].[2022] } on columns,
{ [measure].[Turnover] } on rows
from [Airline Turnover];
The basic structure of MDX consists of a SELECT statement, which specifies the dimensions and measures that are included in the query. In the example MDX expression provided, the SELECT statement includes the following:
On the columns axis, the query includes the Date dimension, specifically the members for the years 2020, 2021, and 2022. This means that the query will return results for these three years on the columns of the result set.
On the rows axis, the query includes the Turnover measure. This means that the query will return the value of the Turnover measure for each combination of year and any other dimensions that are not explicitly specified in the query.
Finally, the FROM clause specifies the name of the OLAP cube or cube view that contains the data being queried. In this case, the cube is called "Airline Turnover".
Use the euclid-cli client tool
# ./euclid-cli
olapcli > select
olapcli > { [Date].[ALL].[2020], [Date].[ALL].[2021], [Date].[ALL].[2022] } on columns,
olapcli > { [measure].[Turnover] } on rows
olapcli > from [Airline Turnover];
- 2020 2021 2022
Turnover 5475632678.00 6559193037.00 7444450321.00