dbTalk Databases Forums  

MDX for averaging

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


Discuss MDX for averaging in the microsoft.public.sqlserver.olap forum.



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

Default MDX for averaging - 06-07-2004 , 05:04 PM






I have a cube with the time dimensions:

year.month.day
and
meter

and the measure:
discharge

I need to know average for all years for the periods June 1-june 6
I mean if we had 20 years we would select 20 sets june 1- june 6 and then
average them

How can I do this?

Reply With Quote
  #2  
Old   
Vladimir Chtepa
 
Posts: n/a

Default Re: MDX for averaging - 06-07-2004 , 06:40 PM






Make new virtual dimension "month-day"

with
set AllYears as '{[year-month-day].[years].memebers}'
member [measures].[YourAverage] as
'sum({[month-day].[06/02]:[month-day].[06/06]}, [measures].[discharge]) /
count(AllYears, EXCLUDEEMPTY)'

select
[measures].[YourAverage] on columns,
[meter].members on rows
from YourCube


"Pavel" <paul_unix (AT) shaw (DOT) ca> schrieb im Newsbeitrag
news:43749bc0.0406071404.6e6e1a5e (AT) posting (DOT) google.com...
Quote:
I have a cube with the time dimensions:

year.month.day
and
meter

and the measure:
discharge

I need to know average for all years for the periods June 1-june 6
I mean if we had 20 years we would select 20 sets june 1- june 6 and then
average them

How can I do this?



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.