Improving Subtotal Calculation

If you have data that varies across dimensions such as date or place, you may need to determine how the data varies in each dimension. ROLLUP and CUBE are extension to the GROUP BY operator that allow you to use one query to compute data using multiple levels of grouping, instead of a separate query for each level.