Table.ApproximateRowCount
TableReturns an approximate row count that may be faster than Table.RowCount for large folded queries.
Syntax
Table.ApproximateRowCount(table as table) as numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | The table whose approximate row count is returned. |
Return Value
number — An approximate number of rows in the table.
Remarks
Table.ApproximateRowCount returns an approximate count of rows in a table. For data sources that support query folding, this function may fold to a fast server-side approximation (such as statistics-based row estimates in SQL Server) instead of performing a full COUNT(*). This makes it much faster for large tables when an exact count is not required.
If the data source does not support an approximate count, the function may fall back to a full row count identical to Table.RowCount. Do not rely on this function when an exact count is required.
Examples
Example 1: Get an approximate row count
Table.ApproximateRowCount(Sales)Result
Result | |
|---|---|
| 1 | 1,000,000 |
Example 2: Use as a quick size check
let
Source = Sql.Database("server", "db"),
Orders = Source{[Schema="dbo", Item="Orders"]}[Data],
ApproxCount = Table.ApproximateRowCount(Orders)
in
ApproxCountResult
Result | |
|---|---|
| 1 | 5,432,100 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✗ Excel Desktop✗ Excel Online✓ Dataflows✓ Fabric Notebooks