Thursday, March 29, 2012

Comparing two dimensions

Hi, I'm writing an MDX query in VS2003 (using RS2000) with AS2000 and I want to know how can I just display the mesaures for the members of a dimension that are equal to another dimension. For example, If I display dimension1 and dimension2 I get (not all of the members in both dimensions are equal):

Cat - Cat
Cat - Dog
Cat - Car
Cat - Horse
Dog - Cat
Dog - Dog
Dog - Car
Dog - Horse
Car- Cat
Car- Dog
Car- Car
Car- Horse
Horse - Cat
Horse - Dog
Horse - Car
Horse - Horse

But I really want to get:

Cat - Cat
Dog - Dog
Car - Car
Horse - Horse

I've tryed using FILTER and I can't make it work, need help here. When I try to use INTERSECT I get the following error:

TITLE: Microsoft Visual Studio

Query preparation failed.

ADDITIONAL INFORMATION:

Calculation error - unknown error (urn:schemas-microsoft-com:xml-analysis)

BUTTONS:

OK

Filter is the right way to go. somethign like the following should work

Select Filter( {<dim1.hier1.level1>.Member * <dim2.hier2.level2>.Members}, <dim1.hier1.CurrentMember.Name = dim2.hier2.CurrentMember.Name ) on 0 from <cube>

Note that this is a bit of an unusual request and won't perform well on large dimensions as joins are normally built into the structure of the cube rather than done at run time.

|||It worked, thanks a lot man. I'm starting to learn MDX and it's quite amazing.

No comments:

Post a Comment