MDX: I need column count based on the total rows

冷暖自知 提交于 2019-12-14 03:24:29

问题


Here we have total 14 rows, I need one more column (RowCount-Column name) every-cell contains 14 (reputation) means total row counts.

below is the query

WITH MEMBER DimName  AS [DimClinic].[Provider Key].CurrentMember.Member_Caption
     MEMBER DimKey   AS [DimClinic].[Provider Key].CurrentMember.Member_Key 

SELECT {[Measures].DimKey  ,
        [Measures].DimName ,
        [Measures].[DrPatientKeyCnt]} ON COLUMNS ,
NonEmpty([DimClinic].[Provider Key].[Provider Key])ON ROWS 
FROM [PopulationReportCube] 

回答1:


WITH 
  MEMBER DimName AS 
    [DimClinic].[Provider Key].CurrentMember.Member_Caption 
  MEMBER DimKey AS 
    [DimClinic].[Provider Key].CurrentMember.Member_Key 
  MEMBER RowCount AS 
    Count
    (
      NonEmpty
      (
        [DimClinic].[Provider Key].[Provider Key]
       ,[Measures].[DrPatientKeyCnt]
      )
    ) 
SELECT 
  {
    [Measures].DimKey
   ,[Measures].DimName
   ,[Measures].[DrPatientKeyCnt]
   ,[Measures].[RowCount]
  } ON COLUMNS
 ,NonEmpty([DimClinic].[Provider Key].[Provider Key]) ON ROWS
FROM [PopulationReportCube];


来源:https://stackoverflow.com/questions/36282243/mdx-i-need-column-count-based-on-the-total-rows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!