use d3 sum and mean