MDX:查询优化

时间:2016-07-19 10:08:33

标签: ssas mdx

要显示结果集,需要2分钟。有没有办法优化查询?

WITH MEMBER [Measures].[TestMeasure] AS
  ( 
    [Measures].[EnrollPatientCnt] 
  + [Measures].[AssessmentPatientCnt] 
  + [Measures].[ProgramAssessmentPatientCnt] 
  )
MEMBER [Measures].[TotalCount] AS
  Count( 
    NonEmpty(
     ( 
       { [DimAssessment].[AssessmentText].[AssessmentText] },
       { [DimAssessment].[QuestionText].[QuestionText] },
       { [DimAssessment].[AnswerText].[AnswerText] } 
     )
    ,{ 
       [Measures].[AssessmentPatientCnt]
     , [Measures].[TestMeasure] 
     }
  ) )
SELECT 
  NON EMPTY [Measures].[TotalCount] ON COLUMNS
FROM [NavigateCube]
WHERE 
  (
    {
      ( 
       { 
         [DimManagedPopulation].[ManagedPopulationName].&[1034]&[TC Tammy Brown Care Team] 
       } 
      )
    } 
  );

2 个答案:

答案 0 :(得分:0)

此查询如何执行?

<div dx-select-box="{
    bindingOptions: {
        dataSource: 'eventLists'
    },
    // other options
}"></div>

它不完全相同,但它与Mosha在博客上发表的关于here的概念类似。

答案 1 :(得分:0)

与Greg / Mosha基本相同:

WITH 
MEMBER [Measures].[TestMeasure] AS
    [Measures].[EnrollPatientCnt] 
  + [Measures].[AssessmentPatientCnt] 
  + [Measures].[ProgramAssessmentPatientCnt] 
MEMBER [Measures].[MeasureIsEmpty] AS
  IIF(
      NOT ISEMPTY([Measures].[TestMeasure])
   OR NOT ISEMPTY([Measures].[AssessmentPatientCnt])
   ,1
   ,NULL
  )
MEMBER [Measures].[TotalCount] AS
  SUM(
     [DimAssessment].[AssessmentText].[AssessmentText]
    *[DimAssessment].[QuestionText].[QuestionText]
    *[DimAssessment].[AnswerText].[AnswerText]
    ,[Measures].[MeasureIsEmpty]
  )
SELECT 
  NON EMPTY [Measures].[TotalCount] ON 0
FROM [NavigateCube]
WHERE [DimManagedPopulation].[ManagedPopulationName].&[1034]&[TC Tammy Brown Care Team];