`WIDTH_BUCKET`

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

markdownreferencev1TWJ5-RPA3guide: data-cloud-query-guidestage: referencetrust: officialsource: developer.salesforce.comservice: data360interface: sql`WIDTH_BUCKET`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/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.

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