I have following data and want to transpose with the revenue as the value of individual years:
Current data:
[{"year": 2017, "month": "Jan", "revenue": 2000},
{"year": 2017, "month": "Feb", "revenue": 3000},
{"year": 2017, "month": "Mar", "revenue": 1000},
{"year": 2016, "month": "Jan", "revenue": 5000},
{"year": 2016, "month": "Feb", "revenue": 4000},
{"year": 2016, "month": "Mar" "revenue": 2000}]
Expected output:
[{Month: "Jan", "2017": 2000, "2016": 5000},
{Month: "Feb", "2017": 3000, "2016": 4000},
{Month: "Mar", "2017": 1000, "2016": 2000}]
I've been trying different ways but no success. Also in future I might have months different than Jan-Mar so any solution which isn't restricted to three months.