在 MDX 中统计 children 个成员

Count children members in MDX

如何计算当前会员的 children 人数?我想打印当年给定月份的天数,例如:

    WITH
MEMBER [Measures].[Label] AS [Dim_Gregorian Calender].[MonthName].CURRENTMEMBER.MEMBER_CAPTION

MEMBER [Measures].[Count] AS 
count(STRTOSET("[Dim_Gregorian Calender].[YMD].[Year].&[" + CStr(Format(Now(), "yyyy")) + "].&[2].children"))

SELECT 
{
    [Measures].[Label]
    ,[Measures].[Count]
} ON 0
,topcount([Dim_Gregorian Calender].[MonthName].[MonthName], 2) ON 1
FROM [Ret] 

现在它显示的计数值不正确(我需要输入一些东西 &[2] 来为每一行计算它)。

我只需要显示两行。

我建议根据您的日期维度添加一个事实 table 来计算行数(天)。尽管如此,您也可以使用 MDX 解决方案:

Count(
  existing [Dim_Gregorian Calender].[YMD].[Day].Members
)