ssasmdx

MDX function to find if a Member IsMemberOf a set


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?


Solution

  • You were close:

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