Accepted answer

Probably easiest to use a helper library like Reductio, which will generate reduce functions for these and other aggregations.

The dc.js FAQ has a pretty extensive discussion on the topic if you want to do this manually. It's not easy to get right for incremental aggregations.

Related Query

More Query from same tag