dbTalk Databases Forums  

Calculating averagesout of averages

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


Discuss Calculating averagesout of averages in the microsoft.public.sqlserver.olap forum.



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

Default Calculating averagesout of averages - 12-13-2004 , 10:13 AM






Hi,

i have the following question:

I have this data:

Number of Employees (data inputted by user)
Country Date Number
----------------------------------
Spain 1-1-2004 580
Ireland 1-1-2004 790
France 1-1-2004 655

Number of sick employees (data inputted by user)
Country Date Number
----------------------------------
Spain 1-1-2004 16
Ireland 1-1-2004 33
France 1-1-2004 25

Average sick employees (per country) (calculated)
Country Date Number
----------------------------------
Spain 1-1-2004 (16/580)*100= 2.75862%
Ireland 1-1-2004 (33/790)*100 = 4.17722%
France 1-1-2004 (25/655)*100=3.81679%

Average sick people (per region) (calculated)
Country Date Number
----------------------------------
Emea 1-1-2004 (74/2025)*100=3.65432%

So when i receive the actual values and calculate the averages with AS i get
3.65432% as a region result.

The problem now is that is don't get the actual values from the user but i
only receive the averages (the percentages). For the individual countries it
doesn't matter. But if i want to calculate the average for the region i get a
different avg. value:
(20%+25%+13.33%)/3=3.58421

So, even when the difference is really small this is not correct. Because
the region average is calculated out of averages you get these differences.
When there are larger values being used this difference can get bigger. Is
there a way to still calculate the average out of 'averages'? Or is this not
possible.
Any thoughts or solution about this?
Thnx,

Stanley



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

Default Re: Calculating averagesout of averages - 12-13-2004 , 07:34 PM






Not sure what the fact table fields are, but assume fields like
Fact.EmplCount and Fact.SickPercent exist, with corresponding cube base
'Sum' measures: EmplCount and SickPercent. And define another base 'Sum'
measure: SickEmpl, with a Source Column expression of 'Fact.EmplCount *
Fact.SickPercent / 100'. Then the calculated measure: AvgSickPercent can
be defined as:

[Measures].[SickEmpl]/[Measures].{EmplCount]



- Deepak

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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.