4 Replies Latest reply on Mar 4, 2014 7:10 PM by SteveMartino

# Using Summary fields in a portal (average)

### Title

Using Summary fields in a portal (average)

### Post

Hello forum  (Phil).    I have a summary field (average) in a portal.  It obviously averages one field of the portal records.   The problem I would like to solve, is if the field is 0, which happens sometimes with the first portal record, the average of, lets say 5 records, includes the zero, which i do not want.  It throws the average off. What I would like it to do is ignore 0  (zero) values, if possible, but I don't want to omit the record from the portal.

I also have 2 other summary fields  Min, and Max.  Max is fine, but minimum can also contain a zero, which I would also like to remove from the minimum summary field calculation.

The only workaround I currently use is to put 2 more fields on the portal GlobalStart and GlobalEnd, which via a script I go to a new layout, and show a report of all the related records, min, max and average, based on a found set  (that I can omit the records with the zero.

I would like to avoid  going to the new layout and just show the proper minimum, maximum and average on the portal.

Any thoughts  or suggestions would be greatly appreciated..

Thanks

Steve

• ###### 1. Re: Using Summary fields in a portal (average)

An average should include zero values. Otherwise it's not an average, it's some other calculation. But average aggregate functions and summary fields ignore empty values so if you defined a calculation field like this:

If ( yourfield ≠ 0 ; YourField )

You can take the average of this calculation field and get an "average" that ignores zero values.

• ###### 2. Re: Using Summary fields in a portal (average)

Thanks Phil.  Quick question, for my situation, does the formula need to be this to evaluate correctly:

If((DDay Between Deliveries / Gallons) ≠ 0 ; (DDay Between Deliveries / Gallons); "")  //This puts a blank in the field instead of a 0

Or will it evaluate correctly the way you wrote it (which I guess would leave a 0 in the field?)

Thanks again

Steve

• ###### 3. Re: Using Summary fields in a portal (average)

Your calc produces the same result. The ; "" can be omitted with no change to the results supplied so it's up to you which way you prefer to write the calculation.

• ###### 4. Re: Using Summary fields in a portal (average)

Thank you Phil.