Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
Calculated column
Calculated table
Measure
Visual calculation
Returns an estimated count of unique values in a column.
Important
Support for APPROXIMATEDISTINCTCOUNT in Import and Direct Lake storage modes is currently in preview.
Syntax
APPROXIMATEDISTINCTCOUNT(<columnName>)
Parameters
| Term | Description |
|---|---|
column |
Input column. |
The column argument can't be an expression.
Return value
The approximate number of distinct values in column.
Remarks
The only argument to this function is a column. Use columns containing any type of data. When the function finds no rows to count, it returns a
BLANK; otherwise, it returns the count of distinct values.In Import mode, Direct Lake on OneLake, and Direct Lake on SQL without fallback, the function uses an engine-side HyperLogLog algorithm.
In DirectQuery mode, the function invokes a corresponding aggregation operation in the data source. This behavior is supported for Azure SQL, Azure Synapse dedicated SQL pool, BigQuery, Databricks, and Snowflake. Direct Lake on SQL uses this DirectQuery behavior when it falls back to DirectQuery mode.
Use this function for high-cardinality columns when an approximate result is acceptable. Use DISTINCTCOUNT when you require an exact result.
For low-cardinality columns,
APPROXIMATEDISTINCTCOUNTmight perform more slowly thanDISTINCTCOUNT. It can also use more memory thanDISTINCTCOUNT, especially with large models, high concurrency, or many group-by groups.The estimated count returned by
APPROXIMATEDISTINCTCOUNThas an error rate of approximately 1.6% for Import and Direct Lake models.