How to setup Total and Grand Total?

How do i Setup my printer template to show, Total of all other groups as “Total” and then Specific Group Total and then Grand Total at the end ?

Can you elaborate a little?