get sum value in a date range for each category