2016-11-18 120 views
0

我試圖創建在計算度量的公式,但沒有正常工作上濾波的多部件

維細胞SSAS計算值度量具有多個成員,包括控制與核心。我也有措施被稱爲[措施]。[費用]這是預先計算的百分比

我需要實現以下公式

(([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.

請注意[措施]。[費用]是個格式,所以不能概括

編輯

同時,任何想法,如果相同以上必須用不同尺寸的兩個切片來完成單個測量
例如。

([措施]。[速率]在[電池]。[ABC]。& [控制]和[電池]。[ABC]。& [核心]也[數據] [PQR]。& [是])

SUM (
    { [Cell].[ABC].&[Control] , [Cell].[ABC].&[Core] } 
    ,{[Data].[PQR].&[Yes])} 
    ,[Measures].[A] 
     ) 

以上是可行的還是什麼將是它的語法

回答

1

Uhmm也許是這樣的:

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; 
+0

感謝 我裏面聚集了尺寸後移動的措施它的工作 – Ashish

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]);