2014-01-23 89 views
0

我創建了兩種不同的計算度量,我想同時使用 計算度量的結果在一個查詢從相同的立方體。組合兩個計算度量和使用組合結果MDX

中創建的計算度量的是 -

With Member [Measures].[VenueSalesCost] 
as 
(
[Measures].[Amount - Reporting Currency] 
) 
Select [Measures].[VenueSalesCost] 
on columns 
from [Project accounting cube] 
where 
[Chart of accounts].[Main account name].&[Venue Hire Costs] 

,第二個是 -

With Member [Measures].[VenueSalesAmount] 
as (
[Measures].[Amount - Reporting Currency] 
) 
Select [Measures].[VenueSalesAmount] 
on columns 
from [Project accounting cube] 
where 
[Chart of accounts].[Main account name].&[Rental of Venue] 

現在,我想在我的query.please讓使用這兩種措施我知道如何結合這兩項措施。

+0

你的措施是完全一樣的。查詢的WHERE條件有什麼不同。你想實現什麼?一個查詢與兩列查詢的結果? – FrankPl

+0

我想使用上述兩項措施並制定第三項措施,其邏輯是[Measures]。[VenueSalesCost] - [Measures]。[VenueSalesAmount] –

回答

0

只需推動不同的查詢條件WHERE到計算度量的定義元組:

With Member [Measures].[VenueSalesCost] 
    as 
    (
    [Chart of accounts].[Main account name].&[Venue Hire Costs], 
    [Measures].[Amount - Reporting Currency] 
    ) 
    Member [Measures].[VenueSalesAmount] 
    as 
    (
    [Chart of accounts].[Main account name].&[Rental of Venue], 
    [Measures].[Amount - Reporting Currency] 
    ) 
    Member [Measures].[new Measure] 
    as 
    [Measures].[VenueSalesCost] - [Measures].[VenueSalesAmount] 
Select { 
     [Measures].[VenueSalesCost], 
     [Measures].[VenueSalesAmount], 
     [Measures].[new Measure] 
     } 
     on columns 
from [Project accounting cube] 
+0

謝謝Frank ..這是一個很好的幫助 –

+0

@AyushKhanduri在這種情況下,你應該將答案標記爲正確答案(點擊勾號,將其變成綠色)。 – FrankPl