2017-08-19 12 views
0

クライアントレポートの1つの問題を解決するにはヘルプが必要です。MDXクエリ:他のディメンションと関連していない場合、クエリ結果にダミーセットを表示する方法はありますか?

以下の2つのmdxクエリの結果を確認してください。

注:2人のメンバーの結果を1(フランスとドイツを合わせたもの)にマージできるように、Union演算子を使用しました。 2番目のセットのディメンションメンバーに関連する場合、ファンクションの最初のセットをチェックする必要があるため、Exist関数をUnionで使用します。

OR条件を実装するためにExistとUnionを使用しました。

あなたは結果セットにダミーセット(フランス&ドイツ)を見つけることができますが、第2 MDXであなたが製品カテゴリ階層が国に関連し、機能チェックを存在されているため、設定ダミー(フランス&ドイツ)を見つけることができない最初のMDXクエリで

そのダミーセットはCountry階層の実際のメンバーではないため、結果セットからダミーセットを削除します。

最終結果(mDX 2)にダミーセットを表示する機能が存在するようにする方法はありますか?

最終結果(mDX 2)にダミーセットを表示する機能が存在するようにする方法はありますか?

MDX 1)

WITH 
    SET [Combined] AS { 
     [Customer].[Customer Geography].[Country].&[France], 
     [Customer].[Customer Geography].[Country].&[Germany] 
    } 
    MEMBER [Customer].[Customer Geography].[France & Germany] AS Aggregate([Combined]) 
SELECT 
    [Measures].[Internet Sales Amount] ON 0, 
    Union(
     Except([Customer].[Customer Geography].[Country], [Combined]), 
     [Customer].[Customer Geography].[France & Germany] 
    ) ON 1 
FROM [Adventure Works] 

結果MDX 1

Internet Sales Amount 
Australia $9,061,000.58 
Canada $1,977,844.86 
United Kingdom $3,391,712.21 
United States $9,389,789.51 
France & Germany $5,538,330.05 

MDXクエリ2)

WITH 
    SET [Combined] AS { 
     [Customer].[Customer Geography].[Country].&[France], 
     [Customer].[Customer Geography].[Country].&[Germany] 
    } 
    MEMBER [Customer].[Customer Geography].[France & Germany] AS Aggregate([Combined]) 
SELECT 
    [Measures].[Internet Sales Amount] ON 0, 

     Union(Exists(Except([Customer].[Customer Geography].[Country], [Combined]), 
     {[Product].[Product Categories].[Category].&[3]} 
     , "Internet Sales") , 

     Exists([Customer].[Customer Geography].[France & Germany],{[Product].[Product Categories].[Category].&[3]} 
    , "Internet Sales")) 

    ON 1 
FROM [Adventure Works] 

結果MDXクエリ2)

Internet Sales Amount 
Australia  $9,061,000.58 
Canada   $1,977,844.86 
United Kingdom $3,391,712.21 
United States $9,389,789.51 

答えて

0

なぜ2番目のクエリで2回存在する必要がありますか?

WITH 
    SET [Combined] AS { 
     [Customer].[Customer Geography].[Country].&[France], 
     [Customer].[Customer Geography].[Country].&[Germany] 
    } 
    MEMBER [Customer].[Customer Geography].[France & Germany] AS Aggregate([Combined]) 
SELECT 
    [Measures].[Internet Sales Amount] ON 0, 

     Union( 
     Exists(
      Except([Customer].[Customer Geography].[Country], [Combined]), 
      {[Product].[Product Categories].[Category].&[3]} 
      ,"Internet Sales" 
     ) 

     //,Exists(
     // [Customer].[Customer Geography].[France & Germany] 
     // ,{[Product].[Product Categories].[Category].&[3]} 
     // ,"Internet Sales" 
     //) 

     ,[Customer].[Customer Geography].[France & Germany] 

     )  
    ON 1 
FROM [Adventure Works]; 
関連する問題