`APPROX_COUNT_DISTINCT`
Data 360 Query Guide, mirrored from developer.salesforce.com: **Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API
markdownreferencev1D83S-9YBZguide: data-cloud-query-guidestage: referencetrust: officialsource: developer.salesforce.comservice: data360interface: sql`APPROX_COUNT_DISTINCT`Data 360Data CloudData 360 Query Guide
Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/approx-count-distinct.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.
APPROX_COUNT_DISTINCT
Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Computes an approximation of the count of distinct values with a specified expected relative error.
<expression>: An expression of any type to count distinct values for.
<error>: Adouble precisionvalue specifying the expected relative error. Must be in the range (0.002, 1]. Defaults to 0.023 (2.3% expected relative error).
Returns a bigint representing the approximate count of distinct values.
- Faster than exact
count(distinct expression)for large datasets. - The error parameter controls the trade-off between accuracy and performance.
- Lower error values provide more accurate results but may require more computation.
Get an approximate count of distinct values.
Specify a custom error rate for higher accuracy.
Returns an approximate count with 1% expected relative error.