AND DAX Function (Logical)

Checks whether all arguments are TRUE, and returns TRUE if all arguments are TRUE.

Syntax

AND ( <Logical1>, <Logical2> )
Parameter Attributes Description
Logical1

The logical values you want to test.

Logical2

The logical values you want to test.

Return values

Scalar A single boolean value.

Remarks

The AND function accepts only two arguments. Consider using the operator && to avoid multiple nested calls in case there are three or more conditions to evaluate in a logical AND.

» 2 related functions

Examples

--  TRUE and FALSE are the two constant values of True and False (1, 0 )
--  AND performs the logical AND between two conditions
--  OR performs the logical OR between two conditions
--  NOT performs logical negation
EVALUATE
    {
        ( "FALSE", FALSE ),
        ( "FALSE()", FALSE() ),
        ( "TRUE", TRUE ),
        ( "TRUE()", TRUE() ),
        ( "AND ( TRUE, FALSE )", AND ( TRUE, FALSE ) ),
        ( "OR ( TRUE, FALSE )", OR ( TRUE, FALSE ) ),
        ( "NOT ( TRUE )", NOT ( TRUE ) ),
        ( "NOT ( FALSE )", NOT ( FALSE ) )        
    }
Value1 Value2
FALSE false
FALSE() false
TRUE true
TRUE() true
AND ( TRUE, FALSE ) false
OR ( TRUE, FALSE ) true
NOT ( TRUE ) false
NOT ( FALSE ) true
--  The AND function can be replaced with the && operator
--  The OR function can be replaced with the || operator
EVALUATE
    {
        ( "AND ( TRUE, FALSE )", AND ( TRUE, FALSE ) ),
        ( "TRUE && FALSE", TRUE && FALSE ),
        ( "OR ( TRUE, FALSE )", OR ( TRUE, FALSE ) ),
        ( "TRUE || FALSE", TRUE || FALSE )
    }
Value1 Value2
AND ( TRUE, FALSE ) false
TRUE && FALSE false
OR ( TRUE, FALSE ) true
TRUE || FALSE true
--  Operators are more convenient when you need to combine
--  more than two conditions.
EVALUATE
    VAR A = TRUE
    VAR B = FALSE
    VAR C = TRUE
RETURN
    {
        ( "Using AND", AND ( A, AND ( B, C ) ) ),
        ( "Using &&",  A && B && C )
    }
Value1 Value2
Using AND false
Using && false

Related functions

Other related functions are:

Last update: Jun 13, 2021   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/and-function-dax

2018-2021 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of AND? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.