dbTalk Databases Forums  

MDX INTERSECT Help please

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss MDX INTERSECT Help please in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peter
 
Posts: n/a

Default MDX INTERSECT Help please - 03-20-2006 , 04:26 PM






Hi

I have to create a query that unions 2 sets and then indicate which members
from set1 was also in set2.

Is there a way to do the following.
SELECT ([Measure].[Sales]) ON 0
( ([SET1] UNIONED [SET2])
,IIF(INTERSECT([SET1], SET2)=TRUE , 0, 1)) ON 1
FROM Cube

Thanks
Peter

Reply With Quote
  #2  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: MDX INTERSECT Help please - 03-22-2006 , 04:37 AM






I think the following might be what you are after. I have based the
query on the Foodmart 2000 sample database and I have assumed that your
Set1 and Set2 are based on members from a single dimension.
Unfortunately the intersection logic requires some knowledge of which
dimension the two sets are based on.


Quote:
WITH
SET Set1 as '{[Product].[All Products].[Drink].[Alcoholic Beverages].
[Beer and Wine].children,[Product].[All Products].[Drink].[Dairy].
[Dairy].children}'
SET Set2 as '{[Product].[All Products].[Drink].[Dairy].
[Dairy].children,[Product].[All Products].[Food].[Baking Goods].[Baking
Goods].children}'
MEMBER Measures.Intersects as 'IIF(INTERSECT(Set1,INTERSECT(Set2,
{Product.CurrentMember})).count =1,1,0)'
Select
{measures.[Store Sales],measures.Intersects} ON 0,
UNION(set1,set2) ON 1
FROM Sales
Quote:
--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <06D80409-9555-4667-9A9D-CD62AE2B6F4C (AT) microsoft (DOT) com>,
Peter (AT) discussions (DOT) microsoft.com says...
Quote:
Hi

I have to create a query that unions 2 sets and then indicate which members
from set1 was also in set2.

Is there a way to do the following.
SELECT ([Measure].[Sales]) ON 0
( ([SET1] UNIONED [SET2])
,IIF(INTERSECT([SET1], SET2)=TRUE , 0, 1)) ON 1
FROM Cube

Thanks
Peter




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.