Example 1:
Query below gets Order Quantity for every quarter.
- WITH MEMBER [Date].[Calendar Weeks].[WTDOrderCount]
AS
AGGREGATE
(
WTD([Date].[Calendar Weeks].currentmember)
)
SELECT
[Measures].[Order Count] ON 0
,{
[Date].[Calendar Weeks].Members,[Date].[Calendar Weeks].[YTD]
} on 1
FROM [Adventure Works];
Example 2:
- Query below gets WTD values for all weeks excluding other members at higher levels.
- WITH MEMBER [Date].[Calendar Weeks].[WTDOrderCount]
AS
AGGREGATE
(
WTD([Date].[Calendar Weeks].currentmember)
)
SELECT
[Measures].[Order Count] ON 0
,{
[Date].[Calendar Weeks].[Calendar Week].Members
,[Date].[Calendar Weeks].[YTD]
} on 1
FROM
(
SELECT {[Date].[Calendar Year].&[2007]} ON 0
FROM [Adventure Works]
)
Example 3:
- WITH MEMBER [Measures].[WTDOrderCount]
AS
SUM
(
WTD([Date].[Calendar Weeks].currentmember)
,[Measures].[Order Count]
)
MEMBER [Measures].[TDOrderCount]
AS
SUM
(
YTD([Date].[Calendar Weeks].currentmember)
,[Measures].[Order Count]
)
MEMBER [Measures].[YTDOrderCount]
AS
SUM
(
YTD([Date].[Calendar Weeks].currentmember)
,[Measures].[Order Count]
)
SELECT
{[Measures].[WTDOrderCount],[Measures].[YTDOrderCount]} ON 0
,{
[Date].[Calendar Weeks].[Calendar Week].Members
} on 1
FROM
(
SELECT {[Date].[Calendar Year].&[2007]} ON 0
FROM [Adventure Works]
)
No comments:
Post a Comment