A, B, & C, it computes the
requested aggregates for the following combinations of columns:
{ABC}- uniqueA B Ctriplets{AB }- uniqueA Bpairs{A C}- uniqueA Cpairs{ BC}- uniqueB Cpairs{A }- uniqueAvalues{ B }- uniqueBvalues{ C}- uniqueCvalues{ }- all values
options map of the /aggregate/groupby endpoint. It is also
available via the SQL CUBE function. Be mindful that
cube is an expensive operation.
Grouping and Nulls
If using the cube operation with a column that contains null values, it may not be apparent which aggregations pertain to the column’s null values and which pertain to all the column’s values, as both will be represented bynull in the result set. To avoid this confusion,
it’s recommended to use the GROUPING()
function to make a distinction between null values in the data and null
grouping values generated by the cube operation. There will be an example of
this below.
Example
The following request will aggregate the average opening stock price for these groups:- Each market sector & stock symbol pair
- Each market sector
- Each stock symbol
- All sectors and symbols
Limitations
- The maximum number of dimensions that can be computed is 256, the maximum number of columns that can be aggregated is 8
- The column(s) used in the cube operation must be listed as columns in the
column_namesparameter - As the cube operation is executed via /aggregate/groupby, all Aggregation Limitations also apply