added metric calculation for sum and average