0

如何更改此脚本,使其HEAD不在聚合函数内SUM

我想这样做的原因是我被警告:

在聚合函数中使用了函数“头”-这会禁用块计算模式

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];
4

1 回答 1

1

你可以更换

Head
      (
        [Date].[Calendar].CurrentMember.Children
       ,11
      )

使用范围表达式:

[Date].[Calendar].CurrentMember.Children.Item(0) : [Date].[Calendar].CurrentMember.Children.Item(10)

但我不确定这是否有助于提高性能。并且它可能会导致少于 11 个孩子的成员出现错误。

于 2014-10-23T21:23:18.133 回答