计算 MDX 中的子成员 [英] Count children members in MDX

查看:38
本文介绍了计算 MDX 中的子成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

 WITH成员 [度量].[标签] AS [Dim_Gregorian Calender].[MonthName].CURRENTMEMBER.MEMBER_CAPTION成员 [措施].[计数] AScount(STRTOSET("[Dim_Gregorian Calender].[YMD].[Year].&[" + CStr(Format(Now(), "yyyy")) + "].&[2].children"))选择{[措施].[标签],[措施].[计数]开 0,topcount([Dim_Gregorian Calender].[MonthName].[MonthName], 2) ON 1来自 [Ret]

现在它向我显示了错误的计数值(我需要插入一些东西并[2] 来为每一行计算它).

我只需要显示两行.

解决方案

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

<块引用>

计数(现有 [Dim_Gregorian Calender].[YMD].[Day].Members)

How I can count number of children, for current member? I would like to print number of days for given month in current year, something like:

    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] 

Now it shows me incorrect values in count (I need to put something insted &[2] to calculate it for every row).

I need to show only two rows.

解决方案

I'd recommend to add a fact table based on your Date dimension to count rows (days). Nonetheless, you may use the MDX solution as well:

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

这篇关于计算 MDX 中的子成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆