基于另一个计算度量的 OLAP 计算度量

OLAP Calculated Measure based on another Calculated Measure

如何添加到基于另一个计算度量的多维数据集计算(新计算度量)?简单地引用这个名字,给我 NULL (我没有得到错误)。更改为不同的度量后,我得到正确的值。

措施 1:

[Measures].[A] + [Measures].[B] - [Measures].[C]

措施 2:

AGGREGATE(NULL:TAIL(EXISTING [Date].[Date].[Date].Members).Item(0), [Measures].[Measure 1])

使用第一个计算度量的计算并添加到它以构建新计算度量的计算。

编辑:

作为我的意思的一个例子,假设你有 [measures].[CalcMeasure1]

计算(定义)为 [measures].[measure_A] + [measures].[measure_B]

并且您想创建 [measures].[CalcMeasure2]measure_C 添加到 CalcMeasure1,您可以给它一个定义:

[measures].[measure_A] + [measures].[measure_B] + [measures].[measure_C]

因此,要使用您问题中的代码,您的措施 2 将是:

AGGREGATE(NULL:TAIL(EXISTING [Date].[Date].[Date].Members).Item(0), ([Measures].[A] + [Measures].[B] - [Measures].[C]))

根据MSDN

Expression: Specify the expression that produces the values of the calculated member. This expression can be written in Multidimensional Expressions (MDX). The expression can contain any of the following:

•Data expressions that represent cube components such as dimensions, levels, measures, and so on

•Arithmetic operators

•Numbers

•Functions

You can drag or copy cube components from the Metadata tab of the Calculation Tools pane to quickly add them to an expression.

Any calculated member that is to be used in the value expression of another calculated member must be created before the calculated member that uses it.