单元格值

Essbase 的 MDX CellValue 函数返回当前单元格的数值。

语法

CellValue

注释

  • 为成员定义格式字符串时,此函数非常有用。大多数 MDX 表达式都可用于指定格式字符串;但是,格式字符串不能包含对数据单元格值(当前正在设置格式的单元格值除外)的引用。使用此函数可引用当前单元格值。

  • 将所有格式字符串包含在 MdxFormat( ) 指令中,如示例中所示。

示例

示例 1

如果当前 [AccountTypes] 成员类型为“费用”,则以下格式字符串将显示当前度量的负值。CellValue 引用正在格式化的当前单元格值。表达式中的 CurrentMember 函数引用正在格式化的单元格的上下文。

/* Display negative values if current Account is an Expense type account */
MdxFormat(
IIF(IsUda(AccountTypes.CurrentMember, "Expense"),
    NumToStr(-CellValue()),
    NumToStr(CellValue()))
)

示例 2

以下格式字符串会将负单元格值显示为括在括号中的正值。


MdxFormat(
   IIF(
         CellValue() < 0,
         Concat(Concat("(", numtostr(-CellValue())), ")" ),
         numtostr(CellValue())
      )
) 

示例 3

此示例说明沿 [Scenario] 维的动态成员 [Variance %]。[Variance %] 具有以下公式,该公式指定如何从 [Actual] 和 [Budget] 计算其值。

[差异百分比] 公式

IIF(Is(Measures.CurrentMember, Title) OR
    Is(Measures.CurrentMember, Performance),
     (Actual – Budget) * 10, (Actual – Budget)*100/Budget)

[Variance %] 还具有以下格式字符串,用于指定应如何显示其值。在这种情况下,根据为 [Variance %] 单元格计算的百分比值,将显示一个文本值,该值表示数字的重要性。

[差异百分比] 格式字符串


MdxFormat(
CASE
    WHEN CellValue() <= 5 THEN		“Low”
    WHEN CellValue() <= 10 THEN		“Medium”
    WHEN CellValue() <= 15 THEN		“High”
    ELSE                                 “Very High”
END
)