Recursive MDX works just like recursive sql. Here's and example ....
WITH
MEMBER RunningTotal AS
CASE
WHEN
ISEmpty([Date].[Date].PrevMember)
THEN 0
ELSE
Sum
(
[Date].[Date].PrevMember
,[Measures].RunningTotal
)
END
+
Sum
(
(
[Date].[Date].CurrentMember
,([Date].[Calendar Weeks].[Calendar Week].&[27]&[2003],[Measures].[Order Count])
)
)
SELECT
{
[Measures].[Order Count]
,RunningTotal
} ON 0
,[Date].[Date].[Date] ON 1
FROM [Adventure Works]
WHERE [Date].[Calendar Weeks].[Calendar Week].&[27]&[2003];
Subscribe to:
Post Comments (Atom)
2 comments:
when we do same for a month:
WITH MEMBER RunningTotal AS
([Date].[Month Name].PrevMember,[Measures].RunningTotal) +
([Date].[Month Name].CurrentMember,[Measures].[Internet Sales Count])
SELECT
{[Measures].[Internet Sales Count],RunningTotal} ON 0,
order({[Date].[Month Name].Members},[Date].[Calendar Year].CurrentMember.Properties("Key"),asc) ON 1
FROM [Analysis Services Tutorial]
it shows wrong result
Remember, the feeling you get from a good is far better than the feeling you get from sitting around wishing you were running. See the link below for more info.
#running
www.ufgop.org
Post a Comment