How Can I Select Rows Based on a Condition in Power BI?

In Power BI, you can select rows based on a condition by using the ‘Filter’ feature. This allows you to specify certain criteria or conditions that the data must meet in order to be included in your analysis. You can use a variety of operators such as equals, not equals, greater than, less than, etc. to define your condition. Additionally, you can use multiple filters to create more complex conditions. This enables you to focus on specific subsets of data and make more targeted and meaningful insights from your data in Power BI.


You can use one of the following methods to select rows based on condition in Power BI:

Method 1: Select Rows Based on One Condition

filtered_data =
CALCULATETABLE('my_data', 'my_data'[Team] = "A")

Method 2: Select Rows Based on Multiple Conditions

filtered_data =
CALCULATETABLE('my_data', 'my_data'[Team] = "A" && 'my_data'[Points] > 20)

Method 3: Select Rows Based on Value in List

filtered_data =
CALCULATETABLE('my_data', 'my_data'[Team] IN {"A", "C"})

The following examples show how to use each method in practice with the following table in Power BI that contains information about various basketball players:

Example 1: Select Rows Based on One Condition

Suppose that we would like to select only the rows from my_table where the value in the Team column is equal to A.

To do so, click the Table tools tab and then click New table and then type the following formula into the formula bar:

filtered_data =
CALCULATETABLE('my_data', 'my_data'[Team] = "A")

This will create a new table that only contains the rows from the original table where the value in the Team column is equal to A:

Power BI select rows based on condition

Example 2: Select Rows Based on Multiple Conditions

Suppose that we would like to select only the rows from my_table where the value in the Team column is equal to A and the value in the Points column is greater than 20.

filtered_data =
CALCULATETABLE('my_data', 'my_data'[Team] = "A" && 'my_data'[Points] > 20)

This will create a new table that only contains the rows from the original table where the value in the Team column is equal to A and the value in the Points column is greater than 20:

Power BI select rows based on multiple conditions

Example 3: Select Rows Based on Value in List

Suppose that we would like to select only the rows from my_table where the value in the Team column is equal to A or C.

To do so, click the Table tools tab and then click New table and then type the following formula into the formula bar:

filtered_data =
CALCULATETABLE('my_data', 'my_data'[Team] IN {"A", "C"})

This will create a new table that only contains the rows from the original table where the value in the Team column is equal to A or C:

Note: In this example we only included two values in the list between the curly brackets, but you can include as many values as you’d like.

Additional Resources

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

x