Database Reference
In-Depth Information
--Query 5.18
WITH SET [Bikes and Clothing] AS
{[Product].[Product Hierarchy].[Product
Category].&[1],
[Product].[Product Hierarchy].[Product
Category].&[3]}
SELECT [Measures].[Sales Amount] ON 0,
[Bikes and Clothing] ON 1
FROM [Adventure Works DW2012];
Using named sets in your code can greatly enhance the readability of your code and
also make it easier to maintain, since you will have one place where you define your
set and hence have one place where you need to change it.
Functions
MDX also comes with a number of functions that can be used when querying your
cube. The function can be divided into several categories such as navigational,
metadata, and statistical. We can start looking at navigational functions, and how
they can be used in queries. An example of a navigational function is the
CURRENTMEMBER function. The CURRENTMEMBER function returns the current mem-
ber in the result set. Consider the following query:
--Query 5.19
WITH MEMBER [Year] AS
[Order
Date].[Hierarchy].CURRENTMEMBER.UNIQUENAME
SELECT [Year] ON 0,
[Order Date].[Hierarchy].[Calendar Year] ON 1
FROM [Adventure Works DW2012];
The query returns the following result set:
Search WWH ::




Custom Search