MDX function to find if a Member IsMemberOf a set

牧云@^-^@ 提交于 2019-12-13 15:49:26

问题


This feels like a really basic question, because it's a really basic function I'm looking for.

I know you can do this:

([Dimension].CurrentMember IS [Dimension].[AParticularMember])

and you get a logical 1 or 0 as the function value.

But how do you do this kind of thing, without concatenating IS functions in a whole lot of ugly ORs:

([Dimension].CurrentMember ISAMEMBEROF 
     {[Dimension].[AMember],[Dimension].[AnotherMember],[Dimension].[YetAnotherMember]}
)

?

This is really basic set operations, in one dimension only, but I just can't find the damn function that does it. I tried this:

NOT(ISEMPTY(INTERSECT([Dimension].CurrentMember,
{[Dimension].[AMember],[Dimension].[AnotherMember],[Dimension].[YetAnotherMember]})))

but it returned True for every dimension member. I'm guessing this is because what is going into the ISEMPTY function is not the dimension member, but the tuple

([Dimension].CurrentMember,[AnotherDimension].DefaultMember,  
[YetAnotherDimension].DefaultMember,... ,Measures.DefaultMember)

does the kind of function I'm looking for exist in MDX?


回答1:


You were close:

INTERSECT([Dimension].CurrentMember,
{[Dimension].[AMember],[Dimension].[AnotherMember],[Dimension].[YetAnotherMember]}).Count > 0


来源:https://stackoverflow.com/questions/32585120/mdx-function-to-find-if-a-member-ismemberof-a-set

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