dbTalk Databases Forums  

MDX for Select all members of one dimension with some exeptions

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


Discuss MDX for Select all members of one dimension with some exeptions in the microsoft.public.sqlserver.olap forum.



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

Default MDX for Select all members of one dimension with some exeptions - 09-19-2006 , 05:47 AM






Dear all

I want to select most members of a dimension and to exclude some of them.
For example:
Dimension store has following members:
- st1
- st2
- st3
- st4

now I want to select all stores without st4. What would be the MDX statement
to use?

Thanks for your help,

Marc


Reply With Quote
  #2  
Old   
Chris Webb
 
Posts: n/a

Default RE: MDX for Select all members of one dimension with some exeptions - 09-19-2006 , 06:07 AM






Hi Marc,

It sounds like you need to use the EXCEPT function. Here's an Adventure
Works example which returns all days of the week except Wednesday:

select [Measures].[Internet Sales Amount] on 0,
except(
[Date].[Day Name].members,
{[Date].[Day Name].&[4]})
on 1
from [Adventure Works]

HTH,

Chris

--
Chris Webb, MVP
Analysis Services and MDX Consultancy: http://www.crossjoin.co.uk
Blog: http://cwebbbi.spaces.live.com/


"Marc" wrote:

Quote:
Dear all

I want to select most members of a dimension and to exclude some of them.
For example:
Dimension store has following members:
- st1
- st2
- st3
- st4

now I want to select all stores without st4. What would be the MDX statement
to use?

Thanks for your help,

Marc


Reply With Quote
  #3  
Old   
Marc
 
Posts: n/a

Default RE: MDX for Select all members of one dimension with some exeption - 09-19-2006 , 07:17 AM



Thanks - the Except Function worked very well!

Best regards,

Marc


Reply With Quote
  #4  
Old   
Jéjé
 
Posts: n/a

Default Re: MDX for Select all members of one dimension with some exeption - 09-19-2006 , 07:46 AM



you can also use the - keyword:
dimension.members - {member 1, member 2 ....}

"Marc" <Roger_Rombooth (AT) community (DOT) nospam> wrote

Quote:
Thanks - the Except Function worked very well!

Best regards,

Marc




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.