calculating average of last measurings