2013-11-24 114 views
0

的總和我剛開始學習MDX和我想要做一個查詢這樣的:由成本 過濾數據(我已經做了該查詢,但沒有總和)這樣的:MDX查詢:濾器和

SELECT [Measures].[SumOfSelled] ON 0,

FILTER ([From].[From].[City].members, [Measures].[SumOfSelled]>7000) ON 1

FROM [BI-Avia]

它的工作

,這是OK BUT! 我也需要以城市來顯示這個過濾結果中過濾元素的總和

我知道如何單獨找到它:

with member [Measures].FilteredSum assum(filter([From].From].City].members,Measures].SunOfSelled]>7000),Measures].[SumOfSelled]) select{SumOfSelled} on 0 from [BI-AVIA]

但我要表明了一起!篩選下的SUM!二合一!我需要你的幫助!我認爲你很清楚!

回答

0

只要定義上[From].[From]層次計算的成員,然後結合兩個查詢,使用集的並集(在MDX縮寫爲+):

with member [From].[From].FilteredSum as 
    sum(filter([From].[From].City].members, Measures].SumOfSelled]>7000)) 

SELECT [Measures].[SumOfSelled] 
     ON 0, 

     FILTER ([From].[From].[City].members, [Measures].[SumOfSelled]>7000) 
     + 
     { [From].[From].FilteredSum } 
     ON 1 

FROM [BI-Avia] 

你可能定義過濾器作爲一組WITH子句,這可以避免Analysis Services對它進行兩次評估。