dbTalk Databases Forums  

Except Grouping MDX Syntax

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


Discuss Except Grouping MDX Syntax in the microsoft.public.sqlserver.olap forum.



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

Default Except Grouping MDX Syntax - 07-22-2004 , 08:28 AM






I am trying to run an MDX query in the MDX Sample Application and I can't
figure out the syntax to properly. Problem:

I have a cube built with 3 dimensions: Time, Question and State.
My cube has 1 measure, "score"

I need to build an mdx query that gives me the "score" values for each
question for the following levels:

All States
Only Illinois and Iowa
All States excluding Illinois and Iowa


I have the syntax for the first 2 items, but I don't know how to create the
last item. I tried using the EXCEPT function, but I keep getting all of the
states, I need to have the "all states excluding Illinois and Iowa" as a
whole. Any help would be appreciated.



Reply With Quote
  #2  
Old   
Scott Jucovics
 
Posts: n/a

Default Re: Except Grouping MDX Syntax - 07-22-2004 , 08:52 AM






I figured this out. You create a "WITH MEMBER " entry similar to :

WITH
MEMBER [State].[All State Except] as 'Aggregate (EXCEPT({[State].[All
State].Children},{[State].[All State].[IL], [State].[All State].[IA],}))'
select
NON EMPTY { [Time].[All Time].[2003].[Q1].[Nov], [Time].[All
Time].[2003].[Q1].[Dec], [Time].[All Time].[2003].[Q1].[Jan] } on columns,
NON EMPTY {[Questions].Children} on rows
from MyCube
WHERE (Measures.[Score], [State].[All State Except])


"Scott Jucovics" <sjucovics (AT) yahoo (DOT) com> wrote

Quote:
I am trying to run an MDX query in the MDX Sample Application and I can't
figure out the syntax to properly. Problem:

I have a cube built with 3 dimensions: Time, Question and State.
My cube has 1 measure, "score"

I need to build an mdx query that gives me the "score" values for each
question for the following levels:

All States
Only Illinois and Iowa
All States excluding Illinois and Iowa


I have the syntax for the first 2 items, but I don't know how to create
the
last item. I tried using the EXCEPT function, but I keep getting all of
the
states, I need to have the "all states excluding Illinois and Iowa" as a
whole. Any help would be appreciated.





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

Default Re: Except Grouping MDX Syntax - 07-22-2004 , 08:59 AM



Hi Scott,

EXCEPT is just removing the members you define from a certain set. You need
to do some calculation operations to get the total value eacept Illinois and
Iowa:

with

member [State].[MyState] as
' [AllStates] - [Illinois] - [Iowa] '

select
....

Cheers,
Matthias

Quote:
I am trying to run an MDX query in the MDX Sample Application and I can't
figure out the syntax to properly. Problem:

I have a cube built with 3 dimensions: Time, Question and State.
My cube has 1 measure, "score"

I need to build an mdx query that gives me the "score" values for each
question for the following levels:

All States
Only Illinois and Iowa
All States excluding Illinois and Iowa


I have the syntax for the first 2 items, but I don't know how to create
the
last item. I tried using the EXCEPT function, but I keep getting all of
the
states, I need to have the "all states excluding Illinois and Iowa" as a
whole. Any help would be appreciated.





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.