How can I create a measure in Power BI that includes multiple filter conditions?

To create a measure in Power BI that includes multiple filter conditions, you will first need to define the measure by selecting the appropriate data fields and applying any necessary calculations. Then, you can use the “Filter” function to add multiple filter conditions to the measure. This function allows you to specify the conditions that need to be met for the measure to be calculated, such as specific values or ranges for certain data fields. By adding multiple filter conditions, you can create a more specific and accurate measure that takes into account various criteria.


You can use the following syntax in DAX to create a measure that filters rows based on multiple conditions:

Method 1: Create Measure by Filtering with AND Condition

Sum of Points =
CALCULATE (
    SUM ( 'my_data'[Points] ),
    'my_data'[Team] = "A" && 'my_data'[Position] = "Guard"
)

This particular example creates a new measure named Sum of Points that calculates the sum of the values in the Points column only for the rows where the Team column is equal to “A” and the Position column is equal to “Guard.”

Method 2: Create Measure by Filtering with OR Condition

Sum of Points =
CALCULATE (
    SUM ( 'my_data'[Points] ),
    'my_data'[Team] = "A" || 'my_data'[Position] = "Guard"
)

This particular example creates a new measure named Sum of Points that calculates the sum of the values in the Points column only for the rows where the Team column is equal to “A” or the Position column is equal to “Guard.”

The following examples show how to use each method in practice with the following table in Power BI named my_data:

Example 1: Create Measure by Filtering with AND Condition

Suppose we would like to calculate the sum of values in the Points column for the players who are on Team A and have a Position of Guard.

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

Then type the following formula into the formula bar:

Sum of Points =
CALCULATE (
    SUM ( 'my_data'[Points] ),
    'my_data'[Team] = "A" && 'my_data'[Position] = "Guard"
)

We can view this measure by switching to the Report View and inserting a card visualization that displays the value of the measure:

We can see that the sum of points for the players who are on Team A and have a Position of Guard is 36.

Example 2: Create Measure by Filtering with OR Condition

Suppose we would like to calculate the sum of values in the Points column for the players who are on Team A or have a Position of Guard.

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

Then type the following formula into the formula bar:

Sum of Points =
CALCULATE (
    SUM ( 'my_data'[Points] ),
    'my_data'[Team] = "A" || 'my_data'[Position] = "Guard"
)

We can view this measure by switching to the Report View and inserting a card visualization that displays the value of the measure:

We can see that the sum of points for the players who are on Team A or have a Position of Guard is 193.

Additional Resources

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

x