Table.IsEmpty Function in Power Query
The Table.IsEmpty function returns true if the table does not contain any rows, otherwise false.
Syntax
Table.IsEmpty(table as table) as logical
Example: Determine if the table is empty.
Power Query M
let
MyTable = Table.FromRecords(
{
[CustomerID = 1, Name = "Ashish", Country = "India"],
[CustomerID = 2, Name = "Katrina", Country = "Australia"],
[CustomerID = 3, Name = "Alia", Country = "China"],
[CustomerID = 4, Name = "Vicky", Country = "India"],
[CustomerID = 5, Name = "Mohini", Country = "Japan"],
[CustomerID = 6, Name = "Meenakshi", Country = "China"],
[CustomerID = 7, Name = "Esha", Country = "India"],
[CustomerID = 8, Name = "Anjali", Country = "Australia"]
}
),
Return = Table.IsEmpty(MyTable)
in
Return The output of the above code is false.
Example: Determine if the table ({}) is empty.
Power Query M
let
source = Table.IsEmpty(Table.FromRecords({}))
in
source The output of the above code is true.