Refactor group totals to transactions aggregate