I have an Activity table with Type,StartDate,EndDate and Amount. I want to calculate the sum of amounts grouped by Type for all the quarters using start date and enddates.