title: D3.js - how to use result in previous step
body: <p>I am trying to get total amount, total price, and average price in one D3 nest statement. How can I use total amount and total price? I am using D3 V4.11.</p>
  
  <pre><code>  var closedByType = d3.nest()
    .key(function (d) { return d.type; })
   .rollup(function(v) {
      return {
  
        amount: d3.sum(v, function(d) {return d.amout}),
        price: d3.sum(v, function(d) {return d.price})
        //averagePrice = Total price /total amount --How can I do it?
      }
      })
    .entries(items);
  </code></pre>