viewof clean = aq.from(raw_data)
.filter(aq.escape(d => d.date >= start_date && d.date <= end_date))
.filter(aq.escape(d => active_list.includes(d.title)))
.rename({master_publisher_aggregated: 'Publisher'})
.derive({
date: aq.escape(d => d3.utcMonday(d.date))
})
.groupby('date', 'title')
.rollup({
spend: d => op.sum(d.spend),
bgc: d => op.sum(d.bgc)
})
.derive({
cpbgc: d => d.spend / d.bgc
})
.view()