ISEMPTY
Whether a table has no rows.
Group: Information. Compatible with DAX.
Syntax
ISEMPTY ( <table_expression> )
| Parameter | Type | Description |
|---|---|---|
table_expression | Table | The table to test: a table of the model or any table expression. |
Returns
Boolean. TRUE when the table is empty, as the filter context leaves it; FALSE when it holds a row or more.
Remarks
- A table of the model is read in the current filter context: in a visual by shop,
ISEMPTY ( Sales )is TRUE for a shop with no sales. - Prefer it to
COUNTROWS ( ... ) = 0: the count of an empty table is BLANK, not 0, and the test says what is meant. - Rows count whatever they hold: a row of blanks is a row.
Examples
A few order lines
EVALUATE
VAR Orders =
DATATABLE (
"Product", STRING, "Liters", INTEGER,
{ { "Pils", 120 }, { "IPA", 80 }, { "Stout", 45 } }
)
RETURN
ROW (
"No lines", ISEMPTY ( Orders ),
"None over 100", ISEMPTY ( FILTER ( Orders, [Liters] > 100 ) ),
"None over 500", ISEMPTY ( FILTER ( Orders, [Liters] > 500 ) )
)
| No lines | None over 100 | None over 500 |
|---|---|---|
| FALSE | FALSE | TRUE |
Places that never bought anything
The depot sells nothing; every shop has sales.
EVALUATE
SUMMARIZECOLUMNS ( Places[Kind], "No sales", ISEMPTY ( Sales ) )
ORDER BY Places[Kind]
| Places[Kind] | No sales |
|---|---|
| Depot | TRUE |
| Shop | FALSE |
An empty table counts as BLANK
EVALUATE
VAR NoRows = FILTER ( DATATABLE ( "n", INTEGER, { { 1 } } ), [n] > 5 )
RETURN
ROW ( "COUNTROWS", COUNTROWS ( NoRows ), "ISEMPTY", ISEMPTY ( NoRows ) )
| COUNTROWS | ISEMPTY |
|---|---|
| (blank) | TRUE |