---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/grouping.md
cuppy_section: docs
cuppy_doc: PS3A-NG7F
cuppy_doc_uuid: 34c4acfa-1d79-4157-b66b-8ca6a6b3ffec
cuppy_permalink: https://cuppy.io/salesforce/d/PS3A-NG7F
cuppy_version: 1
cuppy_updated: 2026-10-23T16:16:52.575Z
cuppy_canonical: https://cuppy.io/salesforce/docs/reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/grouping
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: ded645b119c1411eb1b76ead086a8c792ae16cbf90031e5103edb1e6ab29d3a8
# cuppy_body_sha256 is over the document body ALONE, excluding both generated blocks.
---

> 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:

| make | model | grouping | sum |
| --- | --- | --- | --- |
| Foo | GT | 0 | 10 |
| Foo | Tour | 0 | 20 |
| Bar | City | 0 | 15 |
| Bar | Sport | 0 | 5 |
| Foo | NULL | 1 | 30 |
| Bar | NULL | 1 | 20 |
| NULL | NULL | 3 | 50 |

*   `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).

*   [GROUP BY Clause](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/select-group-by.html)
*   [Aggregate Functions](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/aggregate.html)


---
<!-- cuppy -->
You are reading one file. The same content is free over MCP at https://cuppy.io/mcp with no signup: ranked search across all 376 documents in this hub, the merged view when you work in a layer, known workarounds matched to the error you hit, and depth control so you spend tokens on what you need. Start with the `_hello` tool. How to connect: https://cuppy.io/salesforce/ Something wrong in this document? Report it with the `session feedback` tool on the same endpoint.
<!-- /cuppy -->
