dbTalk Databases Forums  

An average sort of problem?

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


Discuss An average sort of problem? in the microsoft.public.sqlserver.olap forum.



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

Default An average sort of problem? - 11-19-2003 , 05:06 PM






Hi all
This seems like an easy problem to me - by I'm struggling to find the
right MDX expression.

My Analysis Services database analyses sales of product to retail
customers

I simply want to put a calculated measure on to the server called
"last 3 months average rate of sale"
- and track this measure over time to highlight trends

The standard average expression:
avg(lastperiods(3,[time].currentmember),[quantity])
works fine most of the time

But what if we sell a new product!
In the first month, I want the average to be [quantity] / 1
In the second month, it will be [quantity] / 2
Only in the third month do I want to resume a 3 month average.

I suppose that "count" and "excludeempty" are in the solution
somewhere - but that's as far as I've got...

I'll be gratefull for any help on this

Thanks

Ian Bamforth

Reply With Quote
  #2  
Old   
Brian Altmann
 
Posts: n/a

Default An average sort of problem? - 11-20-2003 , 07:10 AM






The average function does not take into account empty
cells.
So your formula will do what you want as is, as long as
you do not fill saleless periods with zeroes.
HTH,
Brian


Quote:
-----Original Message-----
Hi all
This seems like an easy problem to me - by I'm struggling
to find the
right MDX expression.

My Analysis Services database analyses sales of product
to retail
customers

I simply want to put a calculated measure on to the
server called
"last 3 months average rate of sale"
- and track this measure over time to highlight trends

The standard average expression:
avg(lastperiods(3,[time].currentmember),[quantity])
works fine most of the time

But what if we sell a new product!
In the first month, I want the average to be [quantity] /
1
In the second month, it will be [quantity] / 2
Only in the third month do I want to resume a 3 month
average.

I suppose that "count" and "excludeempty" are in the
solution
somewhere - but that's as far as I've got...

I'll be gratefull for any help on this

Thanks

Ian Bamforth
.


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.