MDX:如何获取行数

时间:2016-05-27 13:47:37

标签: mdx

如何获取新列中的行数,请点击上面的图片。 enter image description here

 WITH MEMBER DimName AS [DimHealthPlan].[Health Plan Key].CurrentMember.Member_Caption 
      MEMBER DimKey AS [DimHealthPlan].[Health Plan Key].CurrentMember.Member_Key 
      MEMBER [Measures].[Test]  AS ([Measures].[DrPatientKeyCnt] + [Measures].[NrPatientKeyCnt])
      MEMBER RowCount AS COUNT(NONEMPTY([DimHealthPlan].[Health Plan Key].[Health Plan Key]))
SELECT  {[Measures].DimKey ,
         [Measures].DimName,
         [Measures].[HealthPlanPatientCnt],
         [Measures].[CareProviderPatientCnt],
         [Measures].[PCPPatientCnt], 
         [Measures].[Test],
         RowCount} ON COLUMNS ,
NonEmpty([DimHealthPlan].[Health Plan Key].MEMBERS) ON ROWS 
FROM [PopulationReportCube]

1 个答案:

答案 0 :(得分:1)

试试这个 - 他们都应该说6:

MEMBER RowCount AS 
   COUNT(NONEMPTY([DimHealthPlan].[Health Plan Key].MEMBERS))

但如果你想要一些非常有活力的东西,那么你需要探索Axis功能:

https://msdn.microsoft.com/en-us/library/ms145531.aspx

可以这样实现:

WITH
SET [Rows] AS 
   {Axis(1)}
MEMBER [Number of rows] AS 
   [Rows].Count 
...
...