`GROUPING`

Data 360 Query Guide, mirrored from developer.salesforce.com: **Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

markdownreferencev1PS3A-NG7Fguide: data-cloud-query-guidestage: referencetrust: officialsource: developer.salesforce.comservice: data360interface: sql`GROUPING`Data 360Data CloudData 360 Query Guide

Created 23 Oct 2026 · Modified 23 Oct 2026 · 1 version

Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/grouping.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

GROUPING

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns a bit mask indicating which GROUP BY expressions are not included in the current grouping set.

  • <group_by_expression>: One or more expressions that must exactly match expressions in the GROUP BY clause.

Returns an integer bit mask. Each bit corresponds to an argument, with the rightmost argument as the least-significant bit. A bit is 0 if the expression is in the grouping set; 1 if it is not.

  • Used with grouping sets (ROLLUP, CUBE, GROUPING SETS) to identify which columns were aggregated.
  • Maximum of 31 expressions can be used as arguments.
  • Arguments are not evaluated but must exactly match GROUP BY expressions.
  • Helps distinguish between actual NULL values and NULLs representing aggregated rows.

Identify aggregation levels with ROLLUP.

Returns:

makemodelgroupingsum
FooGT010
FooTour020
BarCity015
BarSport05
FooNULL130
BarNULL120
NULLNULL350
  • 0: Both make and model are grouped.
  • 1: model is aggregated (not grouped).
  • 3: Both make and model are aggregated.

Use GROUPING to filter specific aggregation levels.

Returns only the subtotals by make (where model is aggregated).

Read this document as markdown — the same bytes an agent receives.