title: Group array of objects by multiple properties with Lodash
body: <p>is possible with lodash library group elements by 2 properties?
  I have array of objects like this:</p>
  
  <pre><code>[{
     id: 1,
     amount: 2000,
     date: "2018-01-31T00:00:00.000Z"
  },{
     id: 2,
     amount: 3000,
     date: "2017-07-31T00:00:00.000Z"
  },{
     id: 3,
     amount: 6000,
     date: "2018-01-31T00:00:00.000Z"
  },{
     id: 4,
     amount: 7000,
     date: "2017-01-31T00:00:00.000Z"
  },{
     id: 5,
     amount: 5000,
     date: "2017-03-31T00:00:00.000Z"
  },{
     id: 6,
     amount: 3000,
     date: "2018-02-22T00:00:00.000Z"
  },{
     id: 7,
     amount: 4500,
     date: "2017-01-31T00:00:00.000Z"
  }]
  </code></pre>
  
  <p>My goal is group objects in array by:</p>
  
  <ol>
  <li>year</li>
  <li>month</li>
  </ol>
  
  <p>Purpose of that grouping is that I need in result order these objects' sum of amount by newest. So for that reason I need distinguish January 2017 from January 2018. It should be 2 different groups.</p>
  
  <p>I am not sure if my approach is correct so I write here my required output:</p>
  
  <pre><code>[
    3000, // sum of 2018-2
    8000, // sum of 2018-1
    3000 // sum of 2017-7
    5000 // sum of 2017-3
    11500 // sum of 2017-1
  ]
  </code></pre>
  
  <p>I tried following command but it doesn't work and give me error:</p>
  
  <pre><code>  let xxx = _(data)
      .groupBy(function(i) {
        new Date(i.date).getFullYear()
      })
      .groupBy(function(i) {
        new Date(i.date).getMonth()
      })
      .map(x =&gt; x.amount)
      .sum()
      .orderBy('date').value();
  </code></pre>
  
  <p>Can you help me to fix it ? Thanks.</p>