What is ISEMPTY?
ISEMPTY is a DAX function used to check whether a given expression is empty or not. The expression can be a column, a table, or a value. The ISEMPTY function returns a Boolean value – TRUE if the expression is empty, and FALSE if it’s not.
Here’s the syntax of the ISEMPTY function:
The expression parameter can be any valid DAX expression, such as a column, a table, or a value.
How to Use ISEMPTY
Now that we know what ISEMPTY is, let's see how to use it in Power BI. Here are a few examples:
Example 1: Checking for Empty Columns
Suppose you have a table called Sales that contains three columns - ProductName, SalesAmount, and Profit. You want to check whether the Profit column is empty or not. Here's how you can do it using the ISEMPTY function:
The above DAX expression will return TRUE if the Profit column is empty, and FALSE if it's not.
Example 2: Checking for Empty Tables
Suppose you have two tables - Sales and Expenses. You want to check whether the Expenses table is empty or not. Here's how you can do it using the ISEMPTY function:
The above DAX expression will return TRUE if the Expenses table is empty, and FALSE if it's not.
Example 3: Using ISEMPTY in Calculated Columns
Suppose you have a table called Customers that contains two columns - CustomerName and Country. You want to create a new calculated column called CountryIsEmpty that checks whether the Country column is empty or not. Here's how you can do it using the ISEMPTY function:
1. Go to the Fields pane and select the Customers table.
2. Click on the New Column button in the Modeling tab.
3. Enter the following DAX expression:
CountryIsEmpty = ISEMPTY(Customers[Country])
4. Press Enter to create the new calculated column.
The above DAX expression will create a new column called CountryIsEmpty that returns TRUE if the Country column is empty for a given row, and FALSE if it's not.
In this article, we discussed the ISEMPTY function in Power BI. We saw how to use it to check whether a given expression is empty or not, and saw a few examples of how it can be used in practice. The ISEMPTY function is a powerful tool in the Power BI arsenal and can help you create more accurate and insightful reports and dashboards.