dbTalk Databases Forums  

Help with count and Average

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


Discuss Help with count and Average in the microsoft.public.sqlserver.olap forum.



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

Default Help with count and Average - 09-28-2006 , 09:05 AM






Hi all,

I'm new to OLAP and I need some help with AVG and COUNT functions, I
spent four days without success, and I think it may take four minutes
from you.

I have a fact table (FactTable) which has a measure
([Measures].[MinutesElapsed]).
Also I have a Time dimension (Year, Quarter, Month, and Week)

How can I count Fact records for each week?
How can I calculate the average of [Measures].[MinutesElapsed] for each
week?

Any comments will be very helpful.

Best regards,

Atef


Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Help with count and Average - 09-28-2006 , 05:40 PM






You should create a cube "count" measure, like [FactCount].
Then, if you're using AS 2000, the average weekly record count could be
like:

Avg(Descendants([Time].CurrentMember, [Time].[Week]),
[Measures].[FactCount])


Likewise, the average weekly [MinutesElapsed] would be:

Avg(Descendants([Time].CurrentMember, [Time].[Week]),
[Measures].[MinutesElapsed])


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***

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.