dbTalk Databases Forums  

Need help with averages

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


Discuss Need help with averages in the microsoft.public.sqlserver.olap forum.



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

Default Need help with averages - 07-05-2006 , 10:56 AM






I am trying to compute an average of a measure whose values exceed
zero.

Logically,

sum(values that exceed zero)/(sum(number of values that exceed zero).

I can get an average with this, but it does not filter out zero values.

[Measures].[ValueToAverage]/[Measures].[Quantity]

I keep getting syntax errors when I try to restrict the values down to
non zero values.

([Measures].[Remaining Step Count]/[Measures].[Quantity])
FROM CompletedStep
WHERE ([Measures].[Remaining Step Count] > 0)

I've also tried the avg/filter expression

AVG(Filter([Measures].Members,[Measures].{Remaining Step Count] >
0),[Measures].[Remaining Step Count])

If anyone can help me understand what I'm doing wrong would appreciate


Reply With Quote
  #2  
Old   
Kalyan
 
Posts: n/a

Default RE: Need help with averages - 07-05-2006 , 11:25 AM






Try with IIF statement

"Tiger Tail" wrote:

Quote:
I am trying to compute an average of a measure whose values exceed
zero.

Logically,

sum(values that exceed zero)/(sum(number of values that exceed zero).

I can get an average with this, but it does not filter out zero values.

[Measures].[ValueToAverage]/[Measures].[Quantity]

I keep getting syntax errors when I try to restrict the values down to
non zero values.

([Measures].[Remaining Step Count]/[Measures].[Quantity])
FROM CompletedStep
WHERE ([Measures].[Remaining Step Count] > 0)

I've also tried the avg/filter expression

AVG(Filter([Measures].Members,[Measures].{Remaining Step Count]
0),[Measures].[Remaining Step Count])

If anyone can help me understand what I'm doing wrong would appreciate



Reply With Quote
  #3  
Old   
Tiger Tail
 
Posts: n/a

Default Re: Need help with averages - 07-05-2006 , 05:38 PM



Would it be possible to seea working example using iif?

Thx

Kalyan wrote:
Quote:
Try with IIF statement

"Tiger Tail" wrote:

I am trying to compute an average of a measure whose values exceed
zero.

Logically,

sum(values that exceed zero)/(sum(number of values that exceed zero).

I can get an average with this, but it does not filter out zero values.

[Measures].[ValueToAverage]/[Measures].[Quantity]

I keep getting syntax errors when I try to restrict the values down to
non zero values.

([Measures].[Remaining Step Count]/[Measures].[Quantity])
FROM CompletedStep
WHERE ([Measures].[Remaining Step Count] > 0)

I've also tried the avg/filter expression

AVG(Filter([Measures].Members,[Measures].{Remaining Step Count]
0),[Measures].[Remaining Step Count])

If anyone can help me understand what I'm doing wrong would appreciate




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.