如何更改此脚本以使HEAD
不在聚合函数SUM
中?
我想这样做的原因是我被警告:
功能'Head'用于聚合功能 - 这会禁用块计算模式
WITH
SET [LatestDate] AS
[Date].[Calendar].[Date].&[20060611]
MEMBER [Measures].[Sales] AS
[Measures].[Internet Sales Amount]
MEMBER [Measures].[Sales_EquivMTD] AS
Sum
(
Head
(
[Date].[Calendar].CurrentMember.Children
,11
)
,[Measures].[Sales]
)
SELECT
{
[Measures].[Sales]
,[Measures].[Sales_EquivMTD]
} ON COLUMNS
,NON EMPTY
[Date].[Calendar].[Month].MEMBERS ON ROWS
FROM [Adventure Works];
答案 0 :(得分:1)
你可以替换
Head
(
[Date].[Calendar].CurrentMember.Children
,11
)
带范围表达式:
[Date].[Calendar].CurrentMember.Children.Item(0) : [Date].[Calendar].CurrentMember.Children.Item(10)
但我不确定这是否有助于提升绩效。这可能会导致少于11个孩子的成员出错。