简体   繁体   English

基于其他计算量度的OLAP计算量度

[英]OLAP Calculated Measure based on another Calculated Measure

How I can add to cube calculations (New Calculated Measure) which based on another calculated measure? 如何将基于另一个已计算量度的多维数据集计算(新计算量度)添加到多维数据集计算中? Simply referencing to this name, gives me NULL (I don't get error). 简单地引用这个名字,就给我NULL(我没有得到错误)。 After changing to different measure I get correct value. 更改为其他度量后,我得到了正确的值。

Measure 1: 措施1:

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

Measure 2: 措施2:

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

Use the calculation from your first calculated measure and add to it to build the calculation for your new calculated measure. 使用第一个计算得出的度量的计算结果并将其添加到其中以为新计算得出的度量建立计算。

EDIT: 编辑:

As an example of what I mean, say you have [measures].[CalcMeasure1] 举例来说,假设您有[measures].[CalcMeasure1]

that has a calculation (definition) of [measures].[measure_A] + [measures].[measure_B] 计算(定义)为[measures].[measure_A] + [measures].[measure_B]

And you wanted to create [measures].[CalcMeasure2] that adds measure_C to CalcMeasure1 , you would give it a definition of: 并且您想要创建[measures].[CalcMeasure2] ,将measure_C添加到CalcMeasure1 ,您可以为其定义:

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

So to use the code from your question, your Measure 2 would be: 因此,要使用问题中的代码,措施2将是:

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

According to MSDN : 根据MSDN

Expression: Specify the expression that produces the values of the calculated member. 表达式:指定产生计算所得成员值的表达式。 This expression can be written in Multidimensional Expressions (MDX). 该表达式可以用多维表达式(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. 必须在使用另一个计算成员的值表达式之前创建该计算成员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM