问题
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