MDX查询以创建计算度量

时间:2014-05-06 19:05:23

标签: ssas mdx

我的要求:
计算毛利率,即收入和销售成本的PL金额之差。

销售收入和销售成本属于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';", 

1 个答案:

答案 0 :(得分:1)

我不是一个立方体设计师,所以有点不确定。是否在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';,