dbTalk Databases Forums  

AVG ROLLUP FOR 0 VALUES

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


Discuss AVG ROLLUP FOR 0 VALUES in the microsoft.public.sqlserver.olap forum.



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

Default AVG ROLLUP FOR 0 VALUES - 04-20-2006 , 12:50 AM






Help!

I need an mdx that would provide me avg with that of values.

eg.
intervals measure
00:00-00:30 0
00:30-00:10 0
01:00-01:30 59
01:30-02:00 0
02:00-02:30 10
02:30-03:00 14
03:00-03:30 0
03:30-04:00 59

if i uses straight average it would give me a result of 17.75, but i needed
a result of 35.5. my rollup should provide me the average of those that has
values only or that of greater than 0. how can i do this without having to
create another fact table or cube?

pls help!

thanks! good day!

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

Default Re: AVG ROLLUP FOR 0 VALUES - 04-20-2006 , 07:16 AM






Given that average is simply the sum of a set of amounts divided by the
count of that set, all you need to do is to filter your set, or at least
the set you count to exclude the non-zero members.

In pseudo code it would be something like:

sum(measure) /
count(filter(interval.members, (interval.currentmember,measure) > 0))

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <48529550-22A5-411C-9D7B-DCF2A91CB2B2 (AT) microsoft (DOT) com>,
misheL (AT) discussions (DOT) microsoft.com says...
Quote:
Help!

I need an mdx that would provide me avg with that of values.

eg.
intervals measure
00:00-00:30 0
00:30-00:10 0
01:00-01:30 59
01:30-02:00 0
02:00-02:30 10
02:30-03:00 14
03:00-03:30 0
03:30-04:00 59

if i uses straight average it would give me a result of 17.75, but i needed
a result of 35.5. my rollup should provide me the average of those that has
values only or that of greater than 0. how can i do this without having to
create another fact table or cube?

pls help!

thanks! good day!


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.