Given this data as an example, this is just 2 records, there's hundreds over several months
{
"responses": [{
"responseid": 1,
"q1": 1,
"q2": 1,
"q3": 1,
"q4": 1,
"q5": 2,
"response": "Response 1 example feedback",
"date": "2018-02-12T00:00:00"
},
{
"responseid": 2,
"q1": 1,
"q2": 2,
"q3": 1,
"q4": 1,
"q5": 1,
"response": "Response 2 example feedback",
"date": "2018-03-15T00:00:00"
},
{
"responseid": 3,
"q1": 1,
"q2": 2,
"q3": 1,
"q4": 1,
"q5": 1,
"response": "Response 3 example feedback",
"date": "2018-04-15T00:00:00"
},
{
"responseid": 4,
"q1": 1,
"q2": 2,
"q3": 1,
"q4": 1,
"q5": 1,
"response": "Response 4 example feedback",
"date": "2018-04-15T00:00:00"
}]
}
How do I group the data by the month part so that I can display a count of records in any given month. So the 4 responses above, 2 are from April, 1 each from Feb and March
February 1
March 1
April 2
I'm using Node and Nunjucks.
Thought I'd add, I can group the records by a date as a starting point.
{% for date, items in servicedata.responses | groupby("date") %}
<b>{{ date }}</b> :
{{items.length}}<br>
{% endfor %}