calculate min, max, average