dbTalk Databases Forums  

MDX SUM

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


Discuss MDX SUM in the microsoft.public.sqlserver.olap forum.



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

Default MDX SUM - 04-19-2004 , 08:03 AM






Hi!

Is there a way you can calculate SUM's in the middle of a mdx result
set?

Here is my example data:
GroupID Name Value
1 MyTest1 1260
1 MyTest2 18220
2 MyTest3 130
2 MyTest4 11540

And here is what i want the mdx to return:
Name Value
==============
myTest1 1260
myTest2 18220
Group 1 SUM 19480
myTest3 130
myTest4 11540
Group 2 SUM 11670
Total SUM 31150

Is this posible with native MDX?

Espen Johnsen

Reply With Quote
  #2  
Old   
Patrice Lamarche
 
Posts: n/a

Default Re: MDX SUM - 04-19-2004 , 12:51 PM






Hello,

there is surely a better way to do it.. but it's the only one I know ...
here an example, just replace Education level by your GroupID dimension

With member [Education Level].[Group 1 SUM] AS 'SUM({[Education Level].[All
Education Level].[Bachelors Degree],[Education Level].[All Education
Level].[Graduate Degree]})'

member [Education Level].[Group 2 SUM] AS 'SUM({[Education
Level].[All Education Level].[High School Degree],[Education Level].[All
Education Level].[Partial College]})'

member [Education Level].[Total] AS 'SUM({[Education Level].[Group 2
SUM], [Education Level].[Group 1 SUM]})'

SELECT {[Education Level].[All Education Level].[Bachelors
Degree],[Education Level].[All Education Level].[Graduate Degree],
[Education Level].[Group 1 SUM],[Education Level].[All Education
Level].[High School Degree],[Education Level].[All Education Level].[Partial
College], [Education Level].[Group 2 SUM], [Education Level].[Total] } on
rows, {[Measures].[Store Cost]} on columns from sales


HTH

Patrice Lamarche
"Espen Johnsen" <news (AT) REMOVETHIS (DOT) espenjohnsen.com> wrote

Quote:
Hi!

Is there a way you can calculate SUM's in the middle of a mdx result
set?

Here is my example data:
GroupID Name Value
1 MyTest1 1260
1 MyTest2 18220
2 MyTest3 130
2 MyTest4 11540

And here is what i want the mdx to return:
Name Value
==============
myTest1 1260
myTest2 18220
Group 1 SUM 19480
myTest3 130
myTest4 11540
Group 2 SUM 11670
Total SUM 31150

Is this posible with native MDX?

Espen Johnsen



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.