AND
TRUE when both of two conditions are TRUE (the && operator).
Group: Logical. Compatible with DAX.
Syntax
AND ( <logical1>, <logical2> )
| Parameter | Type | Description |
|---|---|---|
logical1 | Boolean | The first condition. |
logical2 | Boolean | The second condition. |
Returns
Boolean. TRUE when both conditions hold, FALSE otherwise.
Remarks
- It takes exactly two conditions. For three or more, chain the
&&operator,A && B && C, or put one AND inside another. - A blank condition counts as FALSE, and a number as TRUE unless it is 0. Text is an error.
- When the first condition is FALSE, the second is not looked at:
AND ( FALSE (), "a" )is FALSE, although "a" cannot be a condition.
Examples
All four pairs
EVALUATE
VAR Pairs =
DATATABLE (
"A", BOOLEAN, "B", BOOLEAN,
{ { TRUE, TRUE }, { TRUE, FALSE }, { FALSE, TRUE }, { FALSE, FALSE } }
)
RETURN
ADDCOLUMNS ( Pairs, "AND", AND ( [A], [B] ), "&&", [A] && [B] )
| A | B | AND | && |
|---|---|---|---|
| TRUE | TRUE | TRUE | TRUE |
| TRUE | FALSE | FALSE | FALSE |
| FALSE | TRUE | FALSE | FALSE |
| FALSE | FALSE | FALSE | FALSE |
Big Pils months
Sales rows of Pils with more than 1,000 liters; the && form gives the same count.
EVALUATE
ROW (
"AND", COUNTROWS ( FILTER ( Sales, AND ( Sales[Product] = "Pils", Sales[Liters] > 1000 ) ) ),
"&&", COUNTROWS ( FILTER ( Sales, Sales[Product] = "Pils" && Sales[Liters] > 1000 ) )
)
| AND | && |
|---|---|
| 252 | 252 |