Create a subtotal in a summary table

Create a subtotal in a summary table

How do you create a subtotal in a summary table. I would assume that there is a formula that calculates a subtotal and/or grand total. Can you show a formula example? 
In the attached image, I would like to subtotal the three numbers at the "NOT ASSIGNED" brake etc. 
And, add a grand total at the bottom. 

Thanks