One option might be to utilise WITH CUBE or WITH ROLLUP and the Grouping() function
Per BOL;
Grouping is an aggregate function that causes an additional column to be output with a value of 1 when the row is added by either the CUBE or ROLLUP operator, or 0 when the row is not the result of CUBE or ROLLUP.
Grouping is allowed only in the select list associated with a GROUP BY clause that contains either the CUBE or ROLLUP operator