2016-05-12 59 views
1

增加(每週)過濾器,我發現從互聯網上下面的示例,它計算總和[Measures].[Job Advert Value]爲不同[JAP ID].[JAP ID]如何在不同的價值總和在此查詢

但是,它只顯示了所有內容的總和,我只想爲每個星期總結它。

我試着爲時間維度的[Time].[Year - Week - Date].[Week].members添加FILTER,但不起作用。

下面的查詢不帶FILTER功能。

SCOPE([Time].[Year - Week - Date].[Week].members, [Permanent Placement Value].[Value Type Name].&[Vacancies], [Measures].[Job Advert Value]); 

    [Measures].[JAP Advert Value] = 
SUM 
    (
      generate 
      (
       [JAP ID].[JAP ID].MEMBERS AS s, 
       s.CURRENT * 
       TAIL(
        NonEmpty 
         (
         [Time].[Year - Week - Date].[Date].members, 
         (s.CURRENT, [Measures].[Job Advert Value]) 
         ) 
        ) 
      ) 
     , 
     Measures.[Job Advert Value] 
    ); 

END SCOPE; 
+0

如果您將此行更改爲[[Time]。[Year - Week - Date]。[Date] .members' to thi s [[Time]。[Year - Week - Date] .CURRENTMEMBER' does not help – whytheq

回答

0

我建議嘗試以下之一:

SCOPE([Time].[Year - Week - Date].[Week].members 
    , [Permanent Placement Value].[Value Type Name].&[Vacancies] 
    , [Measures].[Job Advert Value]); 

[Measures].[JAP Advert Value] = 
SUM(
    GENERATE(
    [JAP ID].[JAP ID].MEMBERS AS s 
    ,s.CURRENT * 
    TAIL(
    NONEMPTY(
     EXISTING [Time].[Year - Week - Date].[Date].MEMBERS 
     ,(
     s.CURRENT 
     ,[Measures].[Job Advert Value] 
     ) 
    ) 
    ) 
) 
,Measures.[Job Advert Value] 
); 

END SCOPE; 

SCOPE([Time].[Year - Week - Date].[Week].members 
    , [Permanent Placement Value].[Value Type Name].&[Vacancies] 
    , [Measures].[Job Advert Value]); 

[Measures].[JAP Advert Value] = 
SUM(
    GENERATE(
    [JAP ID].[JAP ID].MEMBERS AS s 
    ,s.CURRENT * 
    TAIL(
     NONEMPTY(
     [Time].[Year - Week - Date].CURRENTMEMBER 
     ,(
     s.CURRENT 
     ,[Measures].[Job Advert Value] 
     ) 
    ) 
    ) 
) 
,Measures.[Job Advert Value] 
); 

END SCOPE; 

而且我建議你嘗試的範圍有以下:

SCOPE([Permanent Placement Value].[Value Type Name].&[Vacancies] 
, [Measures].[Job Advert Value]); 
+0

Hi whytheq,Thanks for your reply。它似乎與現有工作。 :) – JJ0022

+0

@ JJ0022很高興幫助 – whytheq

+0

嗨whyth,感謝您的回覆。它似乎與現有工作! :-)但是,通過EXISTING [Time]。[Year - Week - Date]。[Date] .MEMBERS,結果似乎翻了一番。會員可以參加嗎?我可以看到[Time]。[Year - Week - Date]。[Date] .MEMBERS不包含'All'成員。我不確定它爲什麼會增加一倍。 – JJ0022

相關問題