Database Reference
In-Depth Information
Understanding the anatomy of an MDX
query
Now let us examine an MDX query statement, and look at the anatomy of the select
statement.
--Query 5.4
SELECT [Order Date].[Hierarchy].[Calendar Year]
ON COLUMNS,
[Product].[Product Hierarchy].[Product
Category] ON ROWS
FROM [Adventure Works DW2012]
WHERE [Measures].[Fact Internet Sales Count];
We will now go through the query bit-by-bit, and look at the different elements.
The FROM clause
The first section that we will start with is the FROM clause. In MDX, the FROM clause
references the cube or the perspective; it can also reference a subquery. In the earlier
query, you are referencing the Adventure Works DW2012 cube.
The WHERE clause
The WHERE clause filters the query statement to just return the values that you are in-
terested in. Any dimension member or tuple can be specified in the WHERE statement.
In the previous query, you are filtering the result by the measures dimension and you
are specifying the [Measures].[Fact Internet Sales Count] tuple.
The query axis clause
In the previous query, you specified that you wanted to return two different axes—the
column and row axes. In Analysis Services, you can actually reference more than 2
axes; you can define the COLUMNS , ROWS , PAGES , SECTIONS and CHAPTERS axes.
Search WWH ::




Custom Search