d3.csv( "data.csv", function convertRow(row) { // columns are: Campaign,Click Date,clicked return { campaign: row.Campaign, date: row['Click Date'], clicked: parseInt(row.clicked, 10) }; }, function onData(err, data) { console.log('given rows', data) var totals = data.reduce(function (byDate, entry) { var dateParser = d3.timeParse("%d/%m/%Y"); var parsedDate = dateParser(entry.date); var formattedDate = d3.isoFormat(parsedDate); var key = formattedDate; // make sure we have a record for this date if (!byDate[key]) { byDate[key] = { date: formattedDate } } // make sure we have a total for this campaign if (!byDate[key][entry.campaign]) { byDate[key][entry.campaign] = 0 } // increment the total for this campaign byDate[key][entry.campaign] += entry.clicked return byDate }, {}) console.log('totals, by date', totals) } )