dbTalk Databases Forums  

calculating average...

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


Discuss calculating average... in the microsoft.public.sqlserver.olap forum.



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

Default calculating average... - 05-15-2006 , 09:57 AM






Hello, I have the following cube data:

Product Category Shop Units sold days until delivery
======= ======== ==== ========== ===================

ART01 Meat NYC 3 5
ART02 Meat SFO 5 15
ART03 Bread SFO 1 2

I want to calculate the weightened average days until delivery, per
category and/or per shop, which would be:

Category Meat: (3 * 5) from ART01, plus (5 * 15) from ART02 = 90,
divided by 8 = 11,25
Shop SFO: (5 * 15) from ART02, plus (1 * 2) from ART03 = 77, divided by
6 = 12,83

I'm a newbie when it comes to OLAP. What's the formula for a calculated
member to calculate the "average days until delivery"? The formula
should be independent of the dimension, e.g. should
work for Category, Shop, and possibly other dimensions. Is that at all
possible?

I have tried for days to find a solution for this, with no luck. I
would be very thankful for any solution or suggestion.

Best regards,
Urs


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

Default Re: calculating average... - 05-16-2006 , 07:18 AM






I think one way of doing this would be the following:

1. Create a new measure based on the expression [Units sold] * [days
until delivery]. In AS2005 you would define this in the DSV, in AS2000
you would define this measure in the cube itself. This measure can have
its visibility set to false.

2. Create a calculated measure that is [new measure] / [Units sold]

In AS2005 you might also be able to do this all using MDX script, but
the above approach should work across both versions.

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

In article <1147705038.800266.273430 (AT) j33g2000cwa (DOT) googlegroups.com>,
urs.eichmann (AT) gmail (DOT) com says...
Quote:
Hello, I have the following cube data:

Product Category Shop Units sold days until delivery
======= ======== ==== ========== ===================

ART01 Meat NYC 3 5
ART02 Meat SFO 5 15
ART03 Bread SFO 1 2

I want to calculate the weightened average days until delivery, per
category and/or per shop, which would be:

Category Meat: (3 * 5) from ART01, plus (5 * 15) from ART02 = 90,
divided by 8 = 11,25
Shop SFO: (5 * 15) from ART02, plus (1 * 2) from ART03 = 77, divided by
6 = 12,83

I'm a newbie when it comes to OLAP. What's the formula for a calculated
member to calculate the "average days until delivery"? The formula
should be independent of the dimension, e.g. should
work for Category, Shop, and possibly other dimensions. Is that at all
possible?

I have tried for days to find a solution for this, with no luck. I
would be very thankful for any solution or suggestion.

Best regards,
Urs



Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: calculating average... - 05-16-2006 , 01:56 PM



Thanks Darren, that worked fine. Sometimes I can't see the easy
solution because I'm stuck in too deep...


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.