Table.ApproximateRowCount

Updated on

Table.ApproximateRowCount is a Power Query M function that returns the approximate number of rows in a table. The function returns an integer with the approximate row count or an error if the data source doesn’t support approximation.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Table.ApproximateRowCount( table as table ) as number

Description

Table.ApproximateRowCount returns the approximate number of rows in the table. It gives an estimate for the number of rows in table, or an error if approximation isn’t supported.

Examples

Estimate the number of distinct combinations of city and state in a large table, which can be used as a cardinality estimate for the columns. Cardinality estimates are important enough that various data sources ( such as SQL Server ) support this particular approximation, often using an algorithm called HyperLogLog.

// Output: number
Table.ApproximateRowCount( Table.Distinct( Table.SelectColumns( sqlTable, {"city", "state"} ) ) )

Other functions related to Table.ApproximateRowCount are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/table-approximaterowcount

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy