title: grouping data using multiple values javascript
body: <p>I want to parse this data into yearwise and monthwise based on channel name and date wise. If there is no order for particular month or particular date then the order count value of that month and date should be set as zero, </p>
  
  <pre><code>[
  {
  "ordersCount": 8,
  "channel": "test-1",
  "period": "4 Feb 2017"
  },
  {
  "ordersCount": 4,
  "channel": "test-1",
  "period": "25 Feb 2017"
  },
  {
  "ordersCount": 1,
  "channel": "test-2",
  "period": "24 Jan 2018"
  }
  ]
  </code></pre>
  
  <p>my expected oputput is :</p>
  
  <pre><code>[
  {
  "channel": "test-1",
  "Data": {
    "Year": [
      {
        "period": "Jan 2017",
        "orders": 0
      },
      {
        "period": "Feb 2017",
        "totalOrders": 12
      },{
        "period": "Mar 2017",
        "totalOrders": 0
      }...
    ],
    "Month": [
      {
        "period": "Jan 1",
        "totalOrders": 0
      },
      {
        "period": "Jan 2",
        "totalOrders": 0
      }
      ]
    }
   }
   ]
  </code></pre>
  
  <p>This is what I tried :
  <a href="https://jsfiddle.net/v9de43ny/64/" rel="nofollow noreferrer">js fiddle</a></p>