2012-11-15 3 views
2

날짜 범위에 대한 SalesAmount와 LastSalesDate를 가져와야합니다. 그러나 다음 MDX는 날짜 범위별로 필터링되지 않습니다. 기타 데이터는 정상입니다.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]) 

감사합니다. 귀하의 도움을 많이 주시면 감사하겠습니다.

답변

0

필터 문은 필터 대신 날짜 측정 기준에서 모든 날짜를 선택합니다. 또한 불필요한 하위 큐브가있는 곳에 있습니다.

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]