Average and missing value calculation