2

我需要使用 SalesAmount 获取日期范围的 LastSalesDate。但以下 MDX 未按日期范围过滤。其他数据正常。

WITH MEMBER [Measures].[MaxSaleDate] 
    AS 
        TAIL(
            FILTER(
                [Date—Date].[Date].MEMBERS, 
                NOT ISEMPTY([Measures].[Sales])
            )
        ).ITEM(0).NAME

SELECT { [Measures].[MaxSaleDate], NONEMPTY([Measures].[Sales]) } ON COLUMNS,
       { [Store—Store].[Store].MEMBERS * [Store-NoOfDaysSales].[NoOfDays].MEMBERS } ON ROWS
FROM ( SELECT (  
           [Date—Date].[All Date—Date].[2012-10-14 00:00:00.000] :  
           [Date—Date].[All Date—Date].[2012-11-14 00:00:00.000]
       ) ON COLUMNS 
       FROM [Sales])

谢谢。非常感谢您的帮助。

4

1 回答 1

0

您的过滤器语句正在选择日期维度中的所有日期,而不是过滤器。你的 where 也有一个不必要的子立方体。

WITH

MEMBER [Measures].[MaxSaleDate] AS
TAIL(FILTER([Date—Date].[All Date—Date].[2012-10-14 00:00:00.000] :
            [Date—Date].[All Date—Date].[2012-11-14 00:00:00.000],
            NOT ISEMPTY([Measures].[Sales])
            )
      ).ITEM(0).Name

SELECT { [Measures].[MaxSaleDate], NONEMPTY([Measures].[Sales]) } ON COLUMNS,
{ [Store—Store].[Store].MEMBERS * [Store-NoOfDaysSales].[NoOfDays].MEMBERS } ON ROWS
FROM [Sales]
WHERE [Date—Date].[All Date—Date].[2012-10-14 00:00:00.000] :
      [Date—Date].[All Date—Date].[2012-11-14 00:00:00.000]
于 2012-11-15T20:52:53.857 回答