Refactored computation for totals, start date, and end date