I am assuming you have a query for each group and its totals. If that is the case, you create one more query that includes the results of each of the groups and perform your calculations in this last query.
For example, lets say you have fields from the results of each of those queries as follows: one called GroupA and one called GroupB and one called GroupC
Then you create a new query with each of the three above queries as data sources for this final query. You now create a new column in this final query called results. Now you can, in this query, in the results field; do your calculation as GroupA + GroupB - GroupC.