2016-10-25 8 views
1

次のMDX文を使用すると、jobs.cubicの空でない値を持つデポごとの顧客のリストが表示されます。このステートメントはmember_captionが 'PLU'で始まる顧客も除外します。フィルタの次元メンバを調整し、フィルタに基づいて 'All'メンバを調整します

カスタマー階層の「すべて」メンバーを含めると、「PLU」フィルターによって除外された顧客を含むすべての顧客が合計されます。

お客様の声明に記載されているように顧客を選択することもできますし、 'All'メンバーから 'PLU'フィルターで除外された顧客の値を差し引いて返すことも可能ですか?

理想的には、各デポの合計(すべての顧客)を各デポの最初の行として取得したいと考えています。

SELECT 
    {[Measures].[Job Cubic]} ON 0 
,NonEmpty 
    (
     { 
     [Depot].[State - Depot].[214] 
     ,[Depot].[State - Depot].[325] 
     ,[Depot].[State - Depot].[447] 
     ,[Depot].[State - Depot].[534] 
     ,[Depot].[State - Depot].[611] 
     } 
    * 
     { 
     { 
      Filter 
      (
      [Transport Customer].[Customer].[All Customers].Children 
      , 
       Left 
       (
       [Transport Customer].[Customer].CurrentMember.Properties('Member_Caption') 
       ,3 
      ) 
      <> 'PLU' 
     ) 
     } 
     } 
    ,{[Measures].[Job Cubic]} 
) ON 1 
FROM [Transport KPIs] 
WHERE 
    [Fiscal Date].[Year-Qtr-Month-Week-Date].[Month].&[Sep 16]; 

答えて

0

まずあなたを濾過WITH句に設定を移動できる - あなたがして階層[Transport Customer].[Customer]の計算されたメンバーには、このセットを集約する必要がある - そして、あなたのフィルターセットを除くすべての顧客であるセットを作成します。

WITH 
SET [FilteredSet] AS 
    Filter(
     [Transport Customer].[Customer].[All Customers].Children 
    ,Left(
     [Transport Customer].[Customer].CurrentMember.Member_Caption 
     ,3 
    ) 
     <> 'PLU' 
    ) 
SET [All_except_FilteredSet] AS 
    EXCEPT(
     [Transport Customer].[Customer].[All Customers].Children 
    ,[FilteredSet] 
    ) 
MEMBER [Transport Customer].[Customer].[All].[All_except_FilteredSet] AS 
    AGGREGATE([All_except_FilteredSet]) 
SELECT 
    {[Measures].[Job Cubic]} ON 0 
,NonEmpty 
    (
     { 
     [Depot].[State - Depot].[214] 
     ,[Depot].[State - Depot].[325] 
     ,[Depot].[State - Depot].[447] 
     ,[Depot].[State - Depot].[534] 
     ,[Depot].[State - Depot].[611] 
     } 
    * 
     { 
     [Transport Customer].[Customer].[All].[All_except_FilteredSet], 
     [FilteredSet] 
     } 
    ,[Measures].[Job Cubic] 
) ON 1 
FROM [Transport KPIs] 
WHERE 
    [Fiscal Date].[Year-Qtr-Month-Week-Date].[Month].&[Sep 16]; 
+0

ありがとう@whytheq。それが私に必要なものを手に入れました。 – Paul

関連する問題