### Post

Follow# How do I Calculate "Average" on multiple fields?

## I've used this formula

var ie = new Array()

ie[1] = @Nbr 1

ie[2] = @Nbr 2

ie[3] = @Nbr 3

ie[4] = @Nbr 4

ie = ie.filter(function(element){

return element || element === 0 ? true : false;

})

var result = null;

if (ie.length) {

var sum = ie.reduce(function(a, b){return a + b})

result = sum / ie.length

## }

Its saying syntax error

if put in a "number" field on @Nbr 1 E.G.: @Example 1

I tried to put "Money" field and it has a different error

I would like to know the best formula for calculating average

Please sign in to leave a comment.