Solved

How do I use IIF to Avg

Posted on 2010-11-17
2
560 Views
Last Modified: 2012-05-10
Hi experts Max Points.. How do I change this expression so that it will not include the fields with Zero in  the averaging...
=Avg(CDec(IIF(IsNumeric(Trim(Replace(Replace(Fields!ShipmentPercentage.Value,"NaN",""),"%",""))), Trim(Replace(Replace(Fields!ShipmentPercentage.Value,"NaN",""),"%","")) ,  0.0 ) ))

Open in new window

0
Comment
Question by:SPLady
2 Comments
 
LVL 10

Accepted Solution

by:
itcouple earned 500 total points
ID: 34155712
Hi

Way to long expression for my to work out ;)

See below sample which should work.

=AVG(IIF(Fields!Field.value=0,nothing,Fields!Field.value)

I suggest to put your expression into calculated field in dataset (without AVG) just so you can refer to calculated field without building very very long expression in one place.


Hope that helps
Emil
0
 
LVL 1

Author Closing Comment

by:SPLady
ID: 34155847
Thank you Emil! Excellent :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now