过滤多成员的 SSAS Calc 度量
SSAS Calc measure on filtering multi-members
我正在尝试在计算度量中创建公式,但 none 工作正常
Dimension Cell有多个成员,包括Control和Core。我还有一个名为 [Measures].[Rate] 的度量,它预先计算为百分比
我需要实现以下公式
(([Measures].[Rate] in [Cell].[ABC].&[Control] and [Cell].[ABC].&[Core])
- ([Measures].[Rate] not in [Cell].[ABC].&[Control] and [Cell].[ABC].&[Core]))
/ ([Measures].[Rate] in [Cell].[ABC].&[Control] and [Cell].[ABC].&[Core])
类似于 (A+B)/A 但我无法计算单个 A 和 B。
请注意[措施]。[率]为百分比格式,因此无法汇总
编辑
也知道是否必须对来自不同维度的两个切片进行单一测量来完成上述相同操作
例如
([Measures].[Rate] in [Cell].[ABC].&[Control] and [Cell].[ABC].&[Core] also in [Data].[PQR].& [是])
或
SUM (
{ [Cell].[ABC].&[Control] , [Cell].[ABC].&[Core] }
,{[Data].[PQR].&[Yes])}
,[Measures].[A]
)
是否可行或者它的语法是什么
嗯嗯可能是这样的:
CREATE MEASURE [Measures].[SpecialRate]
AS
AGGREGATE({[Cell].[ABC].&[Control],[Cell].[ABC].&[Core]}, [Measures].[Rate])
- AGGREGATE(EXCEPT([Cell].[ABC].MEMBERS,{[Cell].[ABC].&[Control],[Cell].[ABC].&[Core]}), [Measures].[Rate])
/ AGGREGATE({[Cell].[ABC].&[Control],[Cell].[ABC].&[Core]}, [Measures].[Rate])
,VISIBLE = 1;
最简单的方法是重新设计 Cell 维度以包含一个新的汇总列,该列将 Control 和 Core 都包含在一个汇总中。
如果这不可行并且您必须在 MDX 中执行此操作,那么一种方法是在维度上创建一个计算度量,然后使用它:
CREATE MEMBER CurrentCube.[Cell].[ABC].[All].[Control and Core] as
AGGREGATE({[Cell].[ABC].&[Control], [Cell].[ABC].&[Core]})
,VISIBLE=0;
CREATE MEMBER CurrentCube.[Cell].[ABC].[All].[Not Control and Core] as
AGGREGATE(-{[Cell].[ABC].&[Control], [Cell].[ABC].&[Core]})
,VISIBLE=0;
CREATE MEMBER CurrentCube.[Measures].[My Calc] as
(([Measures].[Rate], Cell].[ABC].[All].[Control and Core])
- ([Measures].[Rate], Cell].[ABC].[All].[Not Control and Core]))
/ ([Measures].[Rate], Cell].[ABC].[All].[Control and Core]);
我正在尝试在计算度量中创建公式,但 none 工作正常
Dimension Cell有多个成员,包括Control和Core。我还有一个名为 [Measures].[Rate] 的度量,它预先计算为百分比
我需要实现以下公式
(([Measures].[Rate] in [Cell].[ABC].&[Control] and [Cell].[ABC].&[Core])
- ([Measures].[Rate] not in [Cell].[ABC].&[Control] and [Cell].[ABC].&[Core]))
/ ([Measures].[Rate] in [Cell].[ABC].&[Control] and [Cell].[ABC].&[Core])
类似于 (A+B)/A 但我无法计算单个 A 和 B。
请注意[措施]。[率]为百分比格式,因此无法汇总
编辑
也知道是否必须对来自不同维度的两个切片进行单一测量来完成上述相同操作
例如
([Measures].[Rate] in [Cell].[ABC].&[Control] and [Cell].[ABC].&[Core] also in [Data].[PQR].& [是])
或
SUM (
{ [Cell].[ABC].&[Control] , [Cell].[ABC].&[Core] }
,{[Data].[PQR].&[Yes])}
,[Measures].[A]
)
是否可行或者它的语法是什么
嗯嗯可能是这样的:
CREATE MEASURE [Measures].[SpecialRate]
AS
AGGREGATE({[Cell].[ABC].&[Control],[Cell].[ABC].&[Core]}, [Measures].[Rate])
- AGGREGATE(EXCEPT([Cell].[ABC].MEMBERS,{[Cell].[ABC].&[Control],[Cell].[ABC].&[Core]}), [Measures].[Rate])
/ AGGREGATE({[Cell].[ABC].&[Control],[Cell].[ABC].&[Core]}, [Measures].[Rate])
,VISIBLE = 1;
最简单的方法是重新设计 Cell 维度以包含一个新的汇总列,该列将 Control 和 Core 都包含在一个汇总中。
如果这不可行并且您必须在 MDX 中执行此操作,那么一种方法是在维度上创建一个计算度量,然后使用它:
CREATE MEMBER CurrentCube.[Cell].[ABC].[All].[Control and Core] as
AGGREGATE({[Cell].[ABC].&[Control], [Cell].[ABC].&[Core]})
,VISIBLE=0;
CREATE MEMBER CurrentCube.[Cell].[ABC].[All].[Not Control and Core] as
AGGREGATE(-{[Cell].[ABC].&[Control], [Cell].[ABC].&[Core]})
,VISIBLE=0;
CREATE MEMBER CurrentCube.[Measures].[My Calc] as
(([Measures].[Rate], Cell].[ABC].[All].[Control and Core])
- ([Measures].[Rate], Cell].[ABC].[All].[Not Control and Core]))
/ ([Measures].[Rate], Cell].[ABC].[All].[Control and Core]);