<!-- https://learnsql.cpetoday.com/functions/dax/or -->
# OR

Language: DAX
Category: Logical
Syntax: OR(<logical1>, <logical2>)
Summary: Returns TRUE when at least one of two conditions is true.
Returns: TRUE or FALSE (a scalar).
Level: Beginner
Related: AND, NOT, IF, SWITCH, ISBLANK, FILTER

## What it does
OR combines two tests and returns TRUE when at least one of them is true. Use it to flag items that meet either of two concerns, such as "missing a tax ID or missing a contact." Inside FILTER and CALCULATE, the || operator is commonly used for the same purpose.

## Syntax and arguments
- logical1: the first test, such as `Vendors[TaxID] = BLANK()`.
- logical2: the second test, such as `Vendors[Email] = BLANK()`.

OR takes exactly two tests. To combine more, nest them or use ||.

## Example
The vendor master clean-up needs a list of vendors that cannot be paid cleanly: those without a tax ID, or with no bank details.

```dax
Vendor Needs Review =
IF(
    OR(
        ISBLANK(Vendors[TaxID]),
        ISBLANK(Vendors[BankAccount])
    ),
    1,
    0
)
```

A vendor with either field missing gets a 1. The count of flagged vendors goes on the data quality dashboard, and the list is sent to the AP team.

## Example: a second, different use
Flag a sales line that either lost money or has a large discount, for a margin review:

```dax
Review Lines =
CALCULATE(
    COUNTROWS(Sales),
    FILTER(
        Sales,
        OR(
            Sales[SalesAmount] < Sales[TotalCost],
            Sales[DiscountAmount] > 500
        )
    )
)
```

FILTER keeps rows that meet either condition, and CALCULATE counts them. A line that meets both is counted once.

## Things to watch
- OR is generous. A row is kept if either test is true, so the list can grow fast. Check the size of the result against what you expect.
- OR takes two arguments. Nest them for three or more.
- A blank is treated as zero in a comparison, so a blank amount can make one of the tests true. Check the blank cases on purpose.
- For a count of rows, use COUNTROWS with FILTER, not a sum of two separate counts. Two separate counts double count rows that meet both tests.
- OR returns a logical value. Wrap it in IF or CALCULATE to produce a count or flag.

## In business terms
OR is used for review lists and exception reports: an expense claim with no receipt or no approval, an invoice that is either duplicated or missing a PO, an account that is either overdrawn or inactive. Each condition on its own is worth a look.
