2014-05-06 80 views
0

我的要求:
計算毛利金額這是銷售收入和成本PL量之差。MDX查詢,以創建計算量度

銷售收入和銷售成本屬於PL類別維度,PL金額是度量值。

要計算差異,我寫了以下內容。我如何繼續進行下去?

CREATE MEMBER CURRENT CUBE [Measures].[Gross Margin Amount] AS 
(
([Profit and Loss].[Profit and Loss].[Category].&[100],[Measures].[PL Amount]) - 
([Profit and Loss].[Profit and Loss].[Category].&[200],[Measures].[PL Amount]) 
) 
FORMAT_STRING = "Standard" 
VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'Measure';", 
+0

你得到的錯誤信息是什麼?沒有這個可能很難幫助你。然而,假設你的計算腳本中有這樣的代碼,正確的語法是'CREATE MEMBER CURRENTCUBE。[Measures]。[Gross Margin Amount] AS ...'而不是'CREATE MEMBER CURRENT CUBE [Measures]。[Gross Margin金額] AS ...' – FrankPl

+0

任何你需要'FORMAT_STRING'之前的逗號,並且你應該在分號後省略最後的'「,' – FrankPl

回答

0

我不是一個立方體設計師,所以有點不確定。是否在AGGREGATE功能幫助中添加:

CREATE MEMBER CURRENT CUBE [Measures].[Gross Margin Amount] AS 
(
AGGREGATE([Profit and Loss].[Profit and Loss].[Category].&[100],[Measures].[PL Amount]) - 
AGGREGATE([Profit and Loss].[Profit and Loss].[Category].&[200],[Measures].[PL Amount]) 
), 
FORMAT_STRING = "Standard" 
VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'Measure';, 
+0

完全可以幫到你嗎? – whytheq

+0

對不起,幫助了很多,謝謝你,並且你對 – user3063530

+0

非常好(如果它回答了問題,你可能想點擊綠色的勾號按鈕) – whytheq