2011-08-10 112 views
0

Im新的MDX查詢,我試圖在每一行中增加參加百分比的百分比。下面的代碼:MDX上的百分比計算

SELECT {[Measures].[Client Interventions Count]* [Dim Intervention Attendance].[Attended].Children} ON COLUMNS, 
[Dim Date].[Calendar].[Month Name] ON ROWS 
FROM [Client Intervention] 

procude的結果:

enter image description here

我怎麼可以對每一行計算?例如,2007年11月的第一排,客戶總干預計數= 68,因此百分比計數應該是57/68%

任何想法?謝謝

回答

0

使用計算的成員 - 你可以找到幾個例子here。對於查詢的想法是如下:

WITH MEMBER [Dim Intervention Attendance].[Attended].[%] AS 
    ([Dim Intervention Attendance].[Attended].[Attented], 
     [Measures].[Client Interventions Count]) 
/([Dim Intervention Attendance].[Attended].[Not Attented], 
     [Measures].[Client Interventions Count]) 

SELECT 
    [Measures].[Client Interventions Count] 
    * { [Dim Intervention Attendance].[Attended].[%], 
     [Dim Intervention Attendance].[Attended].Children } ON COLUMNS, 

    [Dim Date].[Calendar].[Month Name] ON ROWS 

FROM [Client Intervention 

]