The divisor for the average calculation should be based on the value array