2017-10-24 19 views
0
ここ

enter image description hereMDX:1つの以上の列の列の合計を取得する方法

私は1つの属性TotalPatientCnt値である持っている(30,2013,39)が、私は1つ以上でTotalPatientCntの(2082)TOTALSUMを必要とします属性。

WITH 
MEMBER [ProgramNames] AS [DimPatientProgram].[Program Key].CURRENTMEMBER.MEMBER_CAPTION 
MEMBER [ProgramKey] AS [DimPatientProgram].[Program Key].CURRENTMEMBER.MEMBER_Key 
MEMBER TotalPatientCnt AS [Measures].[HealthPlanPatientCnt] 
MEMBER MetricPercent AS [Measures].[ProgramPatientKeyCnt] * 1/TotalPatientCnt * 100 ,format_string = '#,##.00' 
SELECT { [ProgramKey] , 
      [ProgramNames] , 
      [Measures].[ProgramPatientKeyCnt] , 
      [TotalPatientCnt] , 
      [MetricPercent] } ON COLUMNS, 
Order (NONEMPTY([DimPatientProgram].[Program Key].[Program Key], 
       [Measures].[ProgramPatientKeyCnt]), 
     [Measures].[ProgramPatientKeyCnt],BASC) ON ROWS 
FROM [PopulationReportCube] 
WHERE ([DimReport].[Report Key].[Care Management Metric], 
     [DimAnchorDate].[Date Key].&[20170930], 
     [DimHealthPlan].[Health Plan Key].[Health Plan Key]) 

答えて

1

WITH句に設定され、あなたの行を移動してみてください:

WITH 
MEMBER [ProgramNames] AS 
    [DimPatientProgram].[Program Key].CURRENTMEMBER.MEMBER_CAPTION 
MEMBER [ProgramKey] AS 
    [DimPatientProgram].[Program Key].CURRENTMEMBER.MEMBER_Key 
MEMBER TotalPatientCnt AS 
    [Measures].[HealthPlanPatientCnt] 
MEMBER MetricPercent AS 
    [Measures].[ProgramPatientKeyCnt] * 1/TotalPatientCnt * 100 ,format_string = '#,##.00' 
SET [RowsSet] AS 
    Order (
     NONEMPTY([DimPatientProgram].[Program Key].[Program Key], 
       [Measures].[ProgramPatientKeyCnt]), 
     [Measures].[ProgramPatientKeyCnt] 
    ,BASC) 
SELECT { [ProgramKey] , 
      [ProgramNames] , 
      [Measures].[ProgramPatientKeyCnt] , 
      [TotalPatientCnt] , 
      [MetricPercent] } ON COLUMNS, 
[RowsSet] ON ROWS 
FROM [PopulationReportCube] 
WHERE ([DimReport].[Report Key].[Care Management Metric], 
     [DimAnchorDate].[Date Key].&[20170930], 
     [DimHealthPlan].[Health Plan Key].[Health Plan Key]); 

次に、そのセットのすべてにまたがる新しいメジャーを作成:

WITH 
MEMBER [ProgramNames] AS 
    [DimPatientProgram].[Program Key].CURRENTMEMBER.MEMBER_CAPTION 
MEMBER [ProgramKey] AS 
    [DimPatientProgram].[Program Key].CURRENTMEMBER.MEMBER_Key 
MEMBER TotalPatientCnt AS 
    [Measures].[HealthPlanPatientCnt] 
MEMBER [Measures].MetricPercent AS 
    [Measures].[ProgramPatientKeyCnt] * 1/TotalPatientCnt * 100 ,format_string = '#,##.00' 
SET [RowsSet] AS 
    Order (
     NONEMPTY([DimPatientProgram].[Program Key].[Program Key], 
       [Measures].[ProgramPatientKeyCnt]), 
     [Measures].[ProgramPatientKeyCnt] 
    ,BASC) 
MEMBER [Measures].[TotalCnt] AS 
    SUM(
    [RowsSet] 
    ,[Measures].[HealthPlanPatientCnt] 
) 
SELECT { [ProgramKey] , 
      [ProgramNames] , 
      [Measures].[ProgramPatientKeyCnt] , 
      [TotalPatientCnt] , 
      [Measures].[TotalCnt], 
      [MetricPercent] } ON COLUMNS, 
[RowsSet] ON ROWS 
FROM [PopulationReportCube] 
WHERE ([DimReport].[Report Key].[Care Management Metric], 
     [DimAnchorDate].[Date Key].&[20170930], 
     [DimHealthPlan].[Health Plan Key].[Health Plan Key]); 
関連する問題