下面指定一些特定日期,然后创建一个calculated member
.
我不是 100% 确定您需要什么,但以下方向是否正确?
注意:我的 Adventure 作品中的日期范围与您不同。
WITH
SET [SpecificDate] AS
[Date].[Calendar].[Date].&[20080401]
SET [SpecificMonths] AS
{ [Date].[Calendar].[Month].&[2008]&[3]:
[Date].[Calendar].[Month].&[2008]&[7] }
MEMBER [Date].[Calendar].[AggregatedMonths] AS
(
AGGREGATE([SpecificMonths])
)
SET [SpecificYear] AS
[Date].[Calendar].[Calendar Year].&[2008]
MEMBER [Date].[Calendar].[CalcMember] AS
(
[Date].[Calendar].[Date].&[20080401] +
[Date].[Calendar].[Month].&[2008]&[3] +
[Date].[Calendar].[Calendar Year].&[2008]
)
Select
{
[Measures].[Reseller Sales Amount]
} ON COLUMNS,
{
[SpecificDate],
[SpecificMonths],
[Date].[Calendar].[AggregatedMonths],
[SpecificYear],
[Date].[Calendar].[CalcMember]
} ON ROWS
FROM [Adventure Works]
如果您希望行上的所有日期(带数据),然后列上的各种度量,例如mtd
然后ytd
您可以执行以下操作:
With
MEMBER [Measures].[CurrentDay] AS
AGGREGATE(
[Date].[Calendar].Currentmember,
[Measures].[Reseller Sales Amount]
)
MEMBER [Measures].[CurrentMonth] AS
AGGREGATE(
[Date].[Calendar].Currentmember.parent,
[Measures].[Reseller Sales Amount]
)
MEMBER [Measures].[CurrentMTD] AS
AGGREGATE(
MTD([Date].[Calendar].CURRENTMEMBER),
[Measures].[Reseller Sales Amount]
)
MEMBER [Measures].[CurrentYTD] AS
AGGREGATE(
YTD([Date].[Calendar].CURRENTMEMBER),
[Measures].[Reseller Sales Amount]
)
Select
non empty
{
[Measures].[CurrentDay],
[Measures].[CurrentMonth],
[Measures].[CurrentMTD],
[Measures].[CurrentYTD]
}
on columns,
non empty
{
[Date].[Calendar].[Date]
}
having [Measures].[CurrentDay]<>null
on rows
From [Adventure Works]