You can form groups in tableau manually or by selecting items from the visual.
By selecting on the visual ->
Select the group of items then click on the group icon.
Now Edit the groups and items within them.
Now place the group in the visual, and also the items in the group on the shelf.
From field ->
Now go to analytics pane and drag the totals and place in sub-totals followed by grandtotals.
Hope it helps.