Combine conditions with AND, OR, && and ||

Test two conditions at once in an IF: flag products that sell lots of units or bring in lots of money with || (OR) and && (AND).

You will learn to

  • Join conditions with && (and) and || (or)
  • Choose between “both must be true” and “either is enough”
  • Know the difference between the AND function and the && operator

How it works

Real rules often have two parts. DAX gives you two ways to join them:

- **Both must be true**: `AND(test 1, test 2)` or `test 1 && test 2` - **Either is enough**: `OR(test 1, test 2)` or `test 1 || test 2`

The functions take exactly two tests. The operators can be chained, `a && b && c`, which is why most people prefer them. When you mix them, add parentheses so the meaning is obvious: `(a || b) && c`.

Picking the right one is the real skill. “Keep a product in stock if it sells lots of units **or** earns lots of money” is very different from requiring **both**: a $1,450 bike rarely sells hundreds of units, and a $9 water bottle never earns $50,000.

Practice it hands-on with a real data model and a live report that updates as you type.

Big Bike Month = IF(AND([Total Sales] >= 20000, [Total Quantity] >= 100), "Yes", "No")