Calculating the average of 5 non-repeating fields - InfoPath Dev
in

InfoPath Dev

Calculating the average of 5 non-repeating fields

Last post 02-15-2012 06:44 AM by edwinbrito. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-14-2012 08:45 PM

    Calculating the average of 5 non-repeating fields

    Hi,

    I need to calculate de average of 5 non-repeating fields. My problem is that I need to do this only if the fields have a value on it. I tried sumung all the fields and dividing the result by 5, but the average is not accurrate if one or more of the fileds have no value.

    Field:  

    a = 10

    b = 10

    c = 10

    d = 10

    e = (empty)

    Ave= (10 +10 +10 +10 +0) / 5 = 8 :-(

    What I want to accomplish is to calculate the average only for the fields that are greater than 1.

    Any sugestions?

    Filed under: , ,
  • 02-14-2012 11:36 PM In reply to

    Re: Calculating the average of 5 non-repeating fields

    Try avg((firstField | secondField | thirdField | fourthField | fifthField)[. > 1])

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 02-15-2012 06:44 AM In reply to

    Re: Calculating the average of 5 non-repeating fields

    It worked like a swiss clock!

    Thanks!!

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.