displaying the added result on grouping the row

hi, is their any option that i can display the sum of the aggregate columns in the aggregated column on grouping the column ?

when its not open it show show the actual column values and when its closed it should the total of the containing column

It possible to define custom templates for column that will show different value based on open or closed state of the row.