Table.RowCount is a Power Query M function that counts the number of rows in a table. The function returns the number of rows as an integer.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Table.RowCount( table as table ) as number
Description
Table.RowCount returns the total number of rows in a specified table. By passing your table as the argument to this function, you can quickly determine the exact number of rows it contains. It’s often used for validating data or to get an idea of the size of your data.
Examples
Let’s see an example of the Table.RowCount function. Suppose you have the following table:

To check how many rows the table contains, you can use the following expression:
// Returns 6
Table.RowCount( Source )
The function is relatively simple. It counts the rows in the provided table value called Source.
Try it yourself
You can try this yourself by pasting the following code in the advanced editor:
let
Source =
#table(
type table[ProductKey = Text.Type, Product = Text.Type, OrderDate = Date.Type, Sales = Text.Type ],
{
{ "1", "Product A", #date(2024, 1, 15) , "150" },
{ "2", "Product B", #date(2024, 2, 20) , "200" },
{ "3", "Product C", #date(2024, 3, 10) , "175" },
{ "4", "Product D", #date(2024, 4, 25) , "220" },
{ "5", "Product E", #date(2024, 5, 5 ) , "185" },
{ "6", "Product F", #date(2024, 6, 15) , "240" }
}
),
NumberOfRows = Table.RowCount( Source )
in
NumberOfRows
Related functions
Other functions related to Table.RowCount are:
2023-2026 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy