Table.RowCount
TableReturns the number of rows in a table.
Syntax
Table.RowCount(table as table) as numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | The table to count rows in. |
Return Value
number — The number of rows in the table.
Remarks
Table.RowCount returns the total number of rows in a table as a single number. This is commonly used inside Table.Group aggregations to count the rows in each group, or in conditional logic to check the size of a table.
Note that this function returns a scalar value (a number), not a table. To display the result as a table in an example, it is wrapped in a record-to-table conversion.
Examples
Example 1: Count rows in a table
let
Count = Table.RowCount(Sales)
in
#table({"RowCount"}, {{Count}})Result
RowCount | |
|---|---|
| 1 | 8 |
Example 2: Count rows per group
Table.Group(Sales, "Region", {{"Orders", each Table.RowCount(_), Int64.Type}})Result
Region | Orders | |
|---|---|---|
| 1 | East | 3 |
| 2 | West | 3 |
| 3 | North | 2 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks