---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/width-bucket.md
cuppy_section: docs
cuppy_doc: TWJ5-RPA3
cuppy_doc_uuid: 9a3d3126-5a06-4716-936a-405aea30cda2
cuppy_permalink: https://cuppy.io/salesforce/d/TWJ5-RPA3
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/width-bucket
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: d4573ff52b7d8a9e15029dac2a9fff59cc9f60fe23d7af2f82d1736576e20a2a
# 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/width-bucket.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.

## `WIDTH_BUCKET`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the bucket number to which an operand is assigned in a histogram of equal-width buckets.

*   `<operand>`: The value to assign to a bucket.
*   `<b1>`: The lower bound of the histogram range.
*   `<b2>`: The upper bound of the histogram range.
*   `<count>`: The number of equal-width buckets spanning the range `b1` to `b2`.

Returns the bucket number as an `int`. The lower bound `b1` is included in the first bucket. Returns `0` for an input below the range, or `count+1` for an input at or above the upper bound `b2`.

*   `count` must be greater than zero, and `b1` and `b2` can’t be equal. Otherwise, the function returns an error.
*   Reverse bounds (`b1` greater than `b2`) to define a descending histogram.
*   Arguments can mix numeric types.

Determine which histogram bucket a value falls into.

Returns `3`.

An operand less than the lower bound returns `0`.

Returns `0`.

An operand at or above the upper bound returns `count+1`.

Returns `6`.

*   [Numeric Types](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/numeric.html)
*   [Mathematical Functions and Operators](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/math-func.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 -->
