Search code examples
mdxwhere-clausecross-join

Can I use crossjoin in WHERE statement in MDX?


Can I use CROSSJOIN in my WHERE statement? I need to take {[Product Attribute].[Attribute Code Number] and [Product Attribute].[Attribute] and compare them. There is a corresponding Code Number to a Product Attribute and when I compare them, I SHOULD get a return such as Douglas Fir or White Pine.

Would a CROSSJOIN even help here? My current query returns Species.Douglas Fir and the boss wants the Species. portion to go away and the only way I can think to accomplish this is with the two members I've listed.


Solution

  • CROSSJOIN is for use when you have two sets from different dimensios ON ROWS (or ON COLUMNS) and want to get every combination of the two (e.g. if one set has 2 members and the other has 3, you'll get 6 rows shown in the end).

    You cannot use it in a WHERE, and I don't see a reason for using them when both sets you're joining are from the same dimension.

    Perhaps you should give us an example of what results you want to see, laid out as a little table with example numbers in.