Database Reference
In-Depth Information
What this query does is return the current member. This can come in handy when
you want to find a neighboring member in the hierarchy. This is something that as an
example can be done using the Lag function.
The Lag functiontakesamemberasitsfirstargument,andthenthenumberofmem-
bers—forward or backward—that you want to return. As an example, the following
query moves one position backward from the current member:
--Query 5.20
WITH MEMBER [Measures].[Year] AS
[Order
Date].[Hierarchy].CURRENTMEMBER.UNIQUENAME
MEMBER [Measures].[Previous Year] AS
[Order
Date].[Hierarchy].CURRENTMEMBER.LAG(1).UNIQUENAME
SELECT {[Measures].[Year],
[Measures].[Previous Year]} ON 0,
[Order Date].[Hierarchy].[Calendar Year] ON 1
FROM [Adventure Works DW2012];
Note
The UNIQUENAME function in the examples above is a metadata function, and is
only used in the examples in order to show the results in the result set. It is not
necessary to include it when the current member is used in calculations.
Search WWH ::




Custom Search