OR
TRUE when either of two conditions is TRUE (the || operator).
Group: Logical. Compatible with DAX.
Syntax
OR ( <logical1>, <logical2> )
| Parameter | Type | Description |
|---|---|---|
logical1 | Boolean | The first condition. |
logical2 | Boolean | The second condition. |
Returns
Boolean. TRUE when at least one condition holds, FALSE when neither does.
Remarks
- It takes exactly two conditions. For more, chain the
||operator,A || B || C. - A blank condition counts as FALSE, and a number as TRUE unless it is 0. Text is an error.
- When the first condition is TRUE, the second is not looked at:
OR ( TRUE (), "a" )is TRUE. - For one column against a list of values,
INis shorter:Products[Product] IN { "Pils", "IPA" }.
Examples
All four pairs
EVALUATE
VAR Pairs =
DATATABLE (
"A", BOOLEAN, "B", BOOLEAN,
{ { TRUE, TRUE }, { TRUE, FALSE }, { FALSE, TRUE }, { FALSE, FALSE } }
)
RETURN
ADDCOLUMNS ( Pairs, "OR", OR ( [A], [B] ), "||", [A] || [B] )
| A | B | OR | || |
|---|---|---|---|
| TRUE | TRUE | TRUE | TRUE |
| TRUE | FALSE | TRUE | TRUE |
| FALSE | TRUE | TRUE | TRUE |
| FALSE | FALSE | FALSE | FALSE |
Liters of two products
EVALUATE
ROW (
"Pils or IPA",
CALCULATE (
[Liters sold],
FILTER ( ALL ( Products[Product] ), OR ( Products[Product] = "Pils", Products[Product] = "IPA" ) )
)
)
| Pils or IPA |
|---|
| 1336210 |
Related functions
AND, NOT, IF, FILTER, CONTAINSROW.