The APPROXIMATEDISTINCTCOUNT DAX Function: Syntax, Requirements, and When (Not) to Use It
Key Takeaways
- APPROXIMATEDISTINCTCOUNT only works in DirectQuery mode against five named data sources. It fails outright in Import mode and Dual storage mode — a requirement several existing explainers skip entirely, and the single most important fact to know before you try to use it.
- The function doesn't run its own counting logic in the DAX engine. It pushes the request down to the source database's native approximate-counting algorithm, so the number you see is generated by Snowflake, BigQuery, Databricks, or Azure SQL — not by Power BI.
- It returns BLANK when there are no rows to count, and an estimated distinct-value count otherwise — never a number DAX guarantees to be exact.
- Its entire reason to exist is speed on very large tables. On a table with a few thousand rows, there's no meaningful performance gain and no reason to trade accuracy for it.
- Because the actual returned number depends on the backend engine's own algorithm, it isn't something you can predict or verify offline. This post says so plainly, rather than inventing a number that looks precise but isn't.
What APPROXIMATEDISTINCTCOUNT Actually Does
APPROXIMATEDISTINCTCOUNT is a DAX aggregation function. It asks the data source itself for an estimated count of unique values in a column. That trades a small amount of accuracy for a large amount of speed. It exists specifically for situations where DISTINCTCOUNT — DAX's exact distinct-count function — becomes a performance bottleneck.
That distinction is the whole point of the function. DISTINCTCOUNT has to examine every value to guarantee an exact answer. On a fact table with a few million rows, that's rarely a problem. Cloud data warehouses often hold fact tables with tens or hundreds of millions of rows. On a table that size, an exact distinct count can turn into one of the slowest calculations on a report page. APPROXIMATEDISTINCTCOUNT gets around that by delegating the work to the source engine's own approximation algorithm. That's the same class of algorithm behind functions like APPROX_COUNT_DISTINCT in Snowflake or BigQuery. It can scan the same data in a fraction of the time, at the cost of a small, bounded margin of error.
The syntax:
APPROXIMATEDISTINCTCOUNT(<column>)
Like AVERAGE and DISTINCTCOUNT, it takes exactly one argument: a column reference. It cannot take an expression. What sets it apart isn't the syntax — it's everything happening underneath it.
Syntax and Requirements
| Requirement | Detail |
|---|---|
| Storage mode | DirectQuery only — Import mode and Dual storage tables can't use this function at all |
| Supported data sources | Azure SQL, Azure Synapse dedicated SQL pool, BigQuery, Databricks, Snowflake |
| Argument | A single column reference — not an expression |
| No matching rows | Returns BLANK |
| Where it's evaluated | Pushed down to the source engine, not computed by the DAX engine locally |
This is worth sitting with for a second: if your model is in Import mode — which most Power BI models are — this function is not available to you at all. Trying to use it produces a validation error the moment you try to save the measure. It's not a warning that shows up after the fact. If you need an approximate count in an Import-mode model, there isn't a DAX-native substitute. You'd need to either switch that table to DirectQuery or compute the approximation upstream, before the data ever reaches Power BI.
The Sample Scenario
Every example below uses the same ClickEvents table — 20 rows of web activity tracked in a DirectQuery-connected source, with CustomerID, SessionID, Country, and EventDate columns. Twenty rows is nowhere near large enough for APPROXIMATEDISTINCTCOUNT to make sense in a real project — it exists here purely to demonstrate syntax and behavior clearly. Every "exact" number below was computed directly against this dataset, not estimated.
| EventID | CustomerID | SessionID | Country | EventDate |
|---|---|---|---|---|
| 1 | C001 | S01 | US | 2026-01-02 |
| 2 | C002 | S02 | US | 2026-01-02 |
| 3 | C001 | S03 | US | 2026-01-03 |
| 4 | C003 | S04 | UK | 2026-01-03 |
| 5 | C004 | S05 | UK | 2026-01-04 |
| 6 | C002 | S06 | US | 2026-01-04 |
| 7 | C005 | S07 | IN | 2026-01-05 |
| 8 | C006 | S08 | IN | 2026-01-05 |
| 9 | C003 | S09 | UK | 2026-01-06 |
| 10 | C007 | S10 | US | 2026-01-06 |
| 11 | C001 | S11 | US | 2026-01-07 |
| 12 | C008 | S12 | IN | 2026-01-07 |
| 13 | C002 | S13 | US | 2026-01-08 |
| 14 | C009 | S14 | UK | 2026-01-08 |
| 15 | C005 | S15 | IN | 2026-01-09 |
| 16 | C010 | S16 | US | 2026-01-09 |
| 17 | C004 | S17 | UK | 2026-01-10 |
| 18 | C006 | S18 | IN | 2026-01-10 |
| 19 | C003 | S19 | UK | 2026-01-11 |
| 20 | C007 | S20 | US | 2026-01-11 |
Example 1: APPROXIMATEDISTINCTCOUNT vs. DISTINCTCOUNT — Same Syntax, Different Engine
Exact Unique Customers = DISTINCTCOUNT(ClickEvents[CustomerID])
Approx Unique Customers = APPROXIMATEDISTINCTCOUNT(ClickEvents[CustomerID])
Across this dataset's 20 rows, there are exactly 10 distinct customers. That's the verified, exact answer DISTINCTCOUNT would return. It's also what you'd expect a well-behaved approximation to land on, or very near. But here's the honest part: the actual number APPROXIMATEDISTINCTCOUNT returns isn't something this post — or any static walkthrough — can tell you in advance. It's generated at query time by the source engine's own algorithm, and that algorithm isn't running in this document. On a small table like this one, most engines return the exact figure anyway. There's simply too little data for approximation to diverge from reality. The gap only becomes visible, and useful, at real scale.
Example 2: What Happens in Import Mode
Try to add APPROXIMATEDISTINCTCOUNT(ClickEvents[CustomerID]) to a table stored in Import mode or Dual storage mode, and Power BI rejects the measure before it ever runs. It doesn't silently fall back to an exact count. This is the detail that trips up the most people researching this function. It looks and reads exactly like DISTINCTCOUNT, right up until you try to actually use it outside DirectQuery. If your table needs to stay in Import mode for performance or offline reasons, DISTINCTCOUNT is your only option. There's no approximate equivalent available to you there.
Example 3: Filtering with CALCULATE
Approx US Customers =
CALCULATE(
APPROXIMATEDISTINCTCOUNT(ClickEvents[CustomerID]),
ClickEvents[Country] = "US"
)
Breaking the sample dataset down by country gives an exact baseline of 4 distinct customers in the US, 3 in the UK, and 3 in India — verified directly against the 20 rows. CALCULATE works with APPROXIMATEDISTINCTCOUNT exactly the way it works with any other aggregation. It narrows the filter context before the function runs, and the approximation happens on whatever subset of rows survives that filter.
Example 4: Why the Error Margin Only Matters at Scale
Microsoft's own documentation describes the accuracy trade-off as "slightly reduced." The algorithm behind it is the same family as APPROX_COUNT_DISTINCT, used in the underlying SQL engines. It's generally understood to stay within a low single-digit percentage of the true count on large datasets. Scaled against this post's exact count of 10 customers, a 2% margin would only mean a difference of roughly 0.2. In practice, that rounds to either the same number or one off. Now scale that same 2% margin up to a real fact table with 50 million distinct customers. You're looking at a plausible range of plus or minus a million. That's comfortably fine for a dashboard KPI tile, and a hard no for a number that has to reconcile to the cent in a finance report.
Example 5: When Not to Use It
A subscription analytics team tracking "unique active accounts this month" across a 200-million-row DirectQuery table in Databricks is a textbook use case. The dashboard needs to load fast, and being off by a few hundred accounts out of tens of thousands doesn't change any decision anyone's making from it. Now swap that same function into a monthly revenue-recognition report that finance has to tie out to an audited general ledger. It becomes the wrong tool entirely — not because it's unreliable, but because "approximately right" and "provably exact" are different requirements. Only DISTINCTCOUNT satisfies the second one.
Core Rules and Default Behavior
- DirectQuery is a hard requirement, not a recommendation. Import mode and Dual storage mode both reject the function outright.
- Only five data sources are supported as of this writing: Azure SQL, Azure Synapse dedicated SQL pool, BigQuery, Databricks, and Snowflake. A DirectQuery model connected to an unsupported source can't use this function even though it's in DirectQuery mode.
- The argument must be a column, never an expression — same restriction as DISTINCTCOUNT and AVERAGE.
- No rows to count returns BLANK. This is a true absence, not a zero — consistent with how most DAX aggregations handle an empty context.
- The exact returned value is not reproducible outside a live connection. It's generated by the source engine's algorithm at query time, which means two identical-looking reports against two different backend engines can return two slightly different numbers for the same underlying data.
In Practice
An analytics engineer at a streaming platform is building a real-time "unique active viewers" tile for an executive dashboard. It's sourced from a Databricks table logging hundreds of millions of viewing events a day, in DirectQuery mode. A DISTINCTCOUNT measure on ViewerID takes several seconds to render and occasionally times out under load. Swapping it for APPROXIMATEDISTINCTCOUNT(Events[ViewerID]) cuts the render time dramatically. Being off by a few thousand viewers out of tens of millions doesn't change anything about how the executive team reads the tile.
The same engineer keeps a completely separate DISTINCTCOUNT-based measure for the monthly subscriber reconciliation report that gets tied out against the billing system. That number has to match exactly, and "fast but approximate" is the wrong trade for a figure someone else is going to audit line by line.
Common Mistakes
Trying to use it in an Import-mode model
This is by far the most common mistake, and it's an easy one to make. Nothing about the function's name or syntax signals the DirectQuery requirement until Power BI rejects the measure. Several existing explanations of this function skip the requirement entirely, which sets people up to hit the error with no idea why.
Reaching for it on a small table expecting a performance win
The function's advantage only shows up at genuine scale — tens of millions of rows or more. On a table with a few thousand rows, DISTINCTCOUNT is already fast. There's no upside to trading accuracy you don't need to save time you weren't losing.
Treating the output as exact
The name says "approximate" for a reason. This function's result isn't safe for a context that requires a provably correct number. That includes financial reconciliation, regulatory reporting, or anything an auditor might check line by line. Using it there defeats the entire purpose of the trade-off it's making.
Assuming the result is identical every time you refresh
The calculation happens inside the source engine's approximation algorithm, not in a fixed DAX formula. Re-running the same measure against the same data can return a very slightly different number between refreshes, depending on how the backend engine's algorithm samples the data that run.
Frequently Asked Questions
What does the APPROXIMATEDISTINCTCOUNT function do in DAX?
It asks the underlying data source for an estimated count of unique values in a column, trading a small amount of accuracy for significantly faster performance on very large tables.
Does APPROXIMATEDISTINCTCOUNT work in Import mode?
No. It requires DirectQuery mode. Import mode and Dual storage mode both reject the function, and there's no DAX-native exact-approximation substitute available in those modes.
Which data sources support APPROXIMATEDISTINCTCOUNT?
As of this writing: Azure SQL, Azure Synapse dedicated SQL pool, BigQuery, Databricks, and Snowflake. A DirectQuery connection to an unsupported source still can't use the function.
How accurate is APPROXIMATEDISTINCTCOUNT compared to DISTINCTCOUNT?
Microsoft describes the accuracy trade-off as slightly reduced rather than exact. The practical error stays small in percentage terms, but that percentage translates to a larger absolute gap the bigger the underlying dataset gets.
What does APPROXIMATEDISTINCTCOUNT return when there are no matching rows?
BLANK — the same behavior as most DAX aggregation functions when there's genuinely nothing to calculate.
Can I use APPROXIMATEDISTINCTCOUNT inside CALCULATE with a filter?
Yes. CALCULATE narrows the filter context first, and the approximation runs against whichever rows remain — the same pattern used with DISTINCTCOUNT or any other aggregation.
Should I use APPROXIMATEDISTINCTCOUNT for financial or compliance reporting?
No. Any figure that needs to reconcile exactly — revenue, audited counts, anything a regulator or auditor might check — calls for DISTINCTCOUNT. Save the approximate function for dashboards and KPIs where being off by a small margin doesn't change a decision.
Frequently Asked Questions
What does the APPROXIMATEDISTINCTCOUNT function do in DAX?
It asks the underlying data source for an estimated count of unique values in a column, trading a small amount of accuracy for significantly faster performance on very large tables.
Does APPROXIMATEDISTINCTCOUNT work in Import mode?
No. It requires DirectQuery mode. Import mode and Dual storage mode both reject the function, and there's no DAX-native exact-approximation substitute available in those modes.
Which data sources support APPROXIMATEDISTINCTCOUNT?
As of this writing: Azure SQL, Azure Synapse dedicated SQL pool, BigQuery, Databricks, and Snowflake. A DirectQuery connection to an unsupported source still can't use the function.
How accurate is APPROXIMATEDISTINCTCOUNT compared to DISTINCTCOUNT?
Microsoft describes the accuracy trade-off as slightly reduced rather than exact. The practical error stays small in percentage terms, but that percentage translates to a larger absolute gap the bigger the underlying dataset gets.
What does APPROXIMATEDISTINCTCOUNT return when there are no matching rows?
BLANK — the same behavior as most DAX aggregation functions when there's genuinely nothing to calculate.
Can I use APPROXIMATEDISTINCTCOUNT inside CALCULATE with a filter?
Yes. CALCULATE narrows the filter context first, and the approximation runs against whichever rows remain — the same pattern used with DISTINCTCOUNT or any other aggregation.
Should I use APPROXIMATEDISTINCTCOUNT for financial or compliance reporting?
No. Any figure that needs to reconcile exactly — revenue, audited counts, anything a regulator or auditor might check — calls for DISTINCTCOUNT. Save the approximate function for dashboards and KPIs where being off by a small margin doesn't change a decision.