Power BI: How to Use “Not Equal” Operator


You can use <> as the “not equal” operator in DAX.

There are two common ways to use this operator in practice:

 Method 1: Use <> to Create New Column

Team Classification =
IF('my_data'[Team] <> "B", "Not on Team B", "On Team B")

Method 2: Use <> to Create New Table

filtered_data =
CALCULATETABLE('my_data', 'my_data'[Team] <> "B")

The following examples show how to use each of these methods in practice with the following table named my_data in Power BI that contains information about various basketball players:

Example 1: Use <> to Create New Column

Suppose we would like to create a new column that contains one of the following strings:

  • “Not on Team B” if the value in the Team column is not equal to “B”
  • “On Team B” if the value in the Team column is equal to “B”

To do so, click the Table tools tab and then click the New column icon:

Then type the following formula into the formula bar:

Team Classification =
IF('my_data'[Team] <> "B", "Not on Team B", "On Team B")

This will create a new column named Team Classification that returns one of the two strings that we specified:

Example 2: Use <> to Create New Table

Suppose we would like to create a new table that only contains the rows from the my_data table where the value in the Team column is not equal to B.

To do so, click the Table tools tab and then click the New table icon:

Then type the following formula into the formula bar:

filtered_data =
CALCULATETABLE('my_data', 'my_data'[Team] <> "B")

This will create a new table named filtered table that only contains the rows from the my_data table where the value in the Team column is not equal to B:

Note: You can find a complete list of operators you can use in DAX here.

Additional Resources

The following tutorials explain how to perform other common tasks in Power BI:

Power BI: How to Use “If Contains” Formula
Power BI: How to Count Distinct Values with Filter
Power BI: How to Create Measure with Multiple Filter Conditions

Leave a Reply

Your email address will not be published. Required fields are marked *