Group By Cube
|AVAILABLE API VERSION|
|API v58.0 and later|
CUBE type adds subtotals for all combinations of a grouped field in the query result. This group by type enables you to create a query to calculate a sum, an average, or another aggregate function. You can then group the results by a horizontal set of values and a vertical set of values.
CUBE with aggregate functions, such as
If you want only subtotals for a subset of the grouped field combinations, use
ROLLUP type instead.
To aggregate results using group by cube, use the following syntax. Replace objectApiName with the object's API name, like Account. Field1 and Field2 represent fields on the object, like Industry and AnnualRevenue.
A query with the
CUBE type can include up to three fields in a comma-separated list in the
groupBy argument clause.