我想获得每年一月至十二月的累计金额
类似于“以下”的内容,但将“第一个月”和“上个月”替换为当年数据。我有 2014 -2017 年的数据
Sum(
[Ship Date].[Date].CURRENT_MEMBER.FirstMonth
: [Ship Date].[Date].CURRENT_MEMBER.LastMonth,[Measures].[Revenue]
)
您可以使用我从 MSDN YTD 页面获取的结构:
WITH MEMBER MEASURES.YTDDEMO AS
AGGREGATE(YTD(), [Measures].[Internet Sales Amount])
SELECT {[Measures].[Internet Sales Amount], MEASURES.YTDDEMO} ON 0,
[Date].[Calendar].MEMBERS ON 1
FROM [Adventure Works]
这是另一种选择:
Aggregate(
PeriodsToDate(
[Date].[Calendar Hierarchy].[Year],
[Date].[Calendar Hierarchy].CurrentMember
),
[Measures].[Sales]
)