Monday, March 12, 2012

MDX Syntax equivalent of SQL (NOT IN) Clause

I have a cube that I'm trying to separate into 2 distinct populations. After filtering on several combinations of dimensions, I get a set of unique people. I have the MDX syntax for this and it works well. However, I then want to turn around and get all of the other people not selected in the first group.

I can't merely take the "not" dimensions of the first group because I have both one-to-one and one-to-many dimensions and doing that will double count a lot of them. Oh yea, I've got a distinct count member hanging around that is needed.

In sql, its very rudimentry but using the "where x not in (select y from tablename .... )" will get the all the others not in the first group.

Any suggestions on getting the equivalent statement in MDX built?

Thanks! jmac

Hi,

I think you should be able to accomplish what you're trying to do using the 'Except' function. Google has lot's of examples of it..

C
|||I'll take a look. Not sure how to get both results into two sets for comparison.|||If you have some crossjoining to get to the set of members you are interested in, you might also need to use the Extract() function in combination with Except() to get just the members from one attribute.

No comments:

Post a Comment