2012-01-19 86 views
2

我爲一個看似基本的MDX問題事先表示歉意。我正在嘗試基於多個維屬性組合來過濾MDX結果集。MDX - 多個位置和/或篩選條件

這是我的尺寸/措施佈局:

尺寸:

[AccidentDate] 
Year 
Quarter 
Month 
Day 
Date 

[ItemInformation] 
ItemState 

[CoverageInformation] 
CoverageHiearchy 
----UserLine 
--- Coverage Code 

措施:

CTDPaid 

現在,我要選擇從[CTDPaid]措施的總額,按分組[ItemInformation].ItemState屬性。但是,我想根據多個過濾條件篩選此查詢的結果集。

這些條件將是以下內容,將分別評價

1. [CoverageInformation].[CoverageHiearchy].&[98]&[002] and [ItemInformation].ItemState.&[MI] 
2. [CoverageInformation].[CoverageHiearchy].&[98]&[004] and [ItemInformation].ItemState.&[MI] 
3. [CoverageInformation].[CoverageHiearchy].&[98]&[004] and [ItemInformation].ItemState.&[IL] 
4. [CoverageInformation].[CoverageHiearchy].&[98]&[002] and [ItemInformation].ItemState.&[IL] 

本質上,如果我端口這個轉移到T-SQL WHERE條件,這將構成如下:

其中

(ItemState = 'MI' and CoverageCode = '002' and UserLine = '98') 

(ItemState = 'MI' and CoverageCode = '004' and UserLine = '98') 

(ItemState = 'IL' and CoverageCode = '002' and UserLine = '98') 

(ItemState = 'IL' and CoverageCode = '004' and UserLine = '98') 

投入的MDX切片機,這將無法正常工作,因爲我相信在同樣的層次結構的交叉連接,不支持。

使用過濾器()MDX函數也不適用於我。

我將非常感謝幫助制定正確的MDX查詢,以正確過濾我的結果集,如上所述。

衷心感謝你爲你的時間

+0

一個CTDPaid可以在 'MI' 和 'IL' 的狀態,在同一時間?如果不是你的查詢沒有結果,因爲你的條件是'ItemState ='MI'和ItemState ='LI'' – danihp

回答

2

嘗試這種解決方案:

SELECT 
    {...} On Columns, 
    {...} On Rows 
FROM (Select 
{([CoverageInformation].[CoverageHiearchy].&[98]&[002], [ItemInformation].ItemState.&[MI]), 
([CoverageInformation].[CoverageHiearchy].&[98]&[004], [ItemInformation].ItemState.&[MI]) 
([CoverageInformation].[CoverageHiearchy].&[98]&[004], [ItemInformation].ItemState.&[IL]) 
([CoverageInformation].[CoverageHiearchy].&[98]&[002], [ItemInformation].ItemState.&[IL])} On Columns 
From [CubeName]) 
+0

謝謝Noe,那就是訣竅! – user1159554