We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

# weighted average function that excludes zeros?

on
Medium Priority
504 Views
Is there a weighted average (or just plain old average) formula or function in Cyrstal Reports XI that exludes zeros?

I have several formula fields that I created were zeros appear.  I want to do an average or weighted average on these detail field for group 1 but the presence of zeros is throughing off the true number.  The reason I have zeros is b/c the formula field requires that the if statement must return a "0" if the statement is false.  Even if I leave out the part "Else 0" I still get zeros were the if statement is false.

{trade.settle_i} is the settlement date of the investment
{trade.days_i} is the term of the investment, i.e, 90 days, 365 days, etc. represented by just numbers like 90, 365, etc.

Else
0

Any input would be greatly appreciated!
Brian
Comment
Watch Question

## View Solution Only

Top Expert 2004
Commented:
There is a weighted average function, at least in XI.
I think what you need is 3 formulas, one of which is the one you posted above.
The second is very similar:

1
Else
0

In the 3rd formula, you can put your weighted average function:

Not the solution you were looking for? Getting a personalized solution is easy.

Senior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
Agree.

Do you need the data fields that are outside your date range for the rest of the reort?

If not use filtering or selection to limit the data in the report to what you want then the average will work.  Check
REPORT --> SELECT EXPERT
Use a formula

mlmcc

Commented:
Yes, I do need the data b/c I used this formula to create YTD columns for years 2000 through 2006.
Senior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
Then you will need to use a formula similar to bdreed's suggestion

mlmcc
Access more of Experts Exchange with a free account
##### Thanks for using Experts Exchange.

Limited access with a free account allows you to:

• View three pieces of content (articles, solutions, posts, and videos)
• Ask the experts questions (counted toward content limit)
• Customize your dashboard and profile