YTD工作正常,但我需要一个去年的价值。以下上一年度YTD仅显示前一年的总金额。例如,2013年8月,年初至今显示2013年1月至8月的年初至今总金额,之前的年初至今应显示2012年1月至8月的年初至今总金额。
YTD
CREATE MEMBER CURRENTCUBE.[Measures].[YTD Amount]
AS AGGREGATE(YTD(), [Measures].[Amount]),
FORMAT_STRING = "$#,##0.00;-$#,##0.00",
NON_EMPTY_BEHAVIOR = { [Amount] },
VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'TF - BU Transaction';
以前的YTD
CREATE MEMBER CURRENTCUBE.[Measures].[Prev YTD Amount]
AS (ParallelPeriod(
[MF - Time].[Year - Month].[Year]
,1
,[MF - Time].[Year - Month].CurrentMember)
, [Measures].[YTD Amount]),
FORMAT_STRING = "$#,##0.00;-$#,##0.00",
NON_EMPTY_BEHAVIOR = { [Amount] },
VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'TF - BU Transaction';
答案 0 :(得分:0)
我不确定您是否可以在PYTD计算中使用年初至今的计算,因为您需要在平行时段之外的YTD。
尝试:
MEMBER [Measures].[Prev YTD Amount] AS
SUM(
YTD(
ParallelPeriod(
[MF - Time].[Year - Month].[Year],
1,
[MF - Time].[Year - Month].CurrentMember
)
),
[Measures].[Amount]
)
来源:www.bidn.com/blogs/cprice1979/ssas/2473/fun-with-mdx-ndash-part-3-ytd-and-prior-ytd-calculations