NOT DAX Function (Logical)

Changes FALSE to TRUE, or TRUE to FALSE.

Syntax

NOT ( <Logical> )
Parameter Attributes Description
Logical

A value or expression that can be evaluated to TRUE or FALSE.

Return values

Scalar A single boolean value.

TRUE or FALSE

Remarks

NOT is not a real function; it is an operator that can be used as a function because of the equivalent syntax.

» 3 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 following example has the purpose of clarifying that NOT is an operator and not a function.

DEFINE
    TABLE 'NOT IN' =
        ADDCOLUMNS (
            CROSSJOIN (
                { FALSE, TRUE },
                SELECTCOLUMNS ( { 0, 1, 2 }, "Expression #", [Value] ),
                SELECTCOLUMNS (
                    { ( FALSE, FALSE ), ( FALSE, TRUE ), ( TRUE, TRUE ) },
                    "List Item 1", [Value1],
                    "List Item 2", [Value2]
                )
            ),
            "Expression",
                SWITCH (
                    [Expression #],
                    0,  "NOT ( " & [Value] & " ) IN …",
                    1,  "NOT ( " & [Value] & " IN … )",
                    2,  "( NOT " & [Value] & " ) IN …"
                ),
            "Result",
                SWITCH (
                    [Expression #],
                    0, NOT ( [Value] ) IN { [List Item 1], [List Item 2] },
                    1, NOT ( [Value] IN { [List Item 1], [List Item 2] } ),
                    2, ( NOT [Value] ) IN { [List Item 1], [List Item 2] }
                )
        )

EVALUATE
SELECTCOLUMNS (
    VALUES ( 'NOT IN'[Expression] ),
    "Expression", 'NOT IN'[Expression],
    "…{ FALSE, FALSE }",
        CALCULATE (
            VALUES ( 'NOT IN'[Result] ),
            'NOT IN'[List Item 1] = FALSE,
            'NOT IN'[List Item 2] = FALSE
        ),
    "…{ TRUE, TRUE }",
        CALCULATE (
            VALUES ( 'NOT IN'[Result] ),
            'NOT IN'[List Item 1] = TRUE,
            'NOT IN'[List Item 2] = TRUE
        ),
    "…{ FALSE, TRUE }",
        CALCULATE (
            VALUES ( 'NOT IN'[Result] ),
            'NOT IN'[List Item 1] = FALSE,
            'NOT IN'[List Item 2] = TRUE
        )
)
ORDER BY […{ FALSE, FALSE }] ASC

Expression …{ FALSE, FALSE } …{ TRUE, TRUE } …{ FALSE, TRUE }
NOT ( FALSE ) IN … false true false
NOT ( FALSE IN … ) false true false
( NOT FALSE ) IN … false true true
NOT ( TRUE ) IN … true false false
NOT ( TRUE IN … ) true false false
( NOT TRUE ) IN … true false true

Related functions

Other related functions are:

Last update: Mar 13, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber

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

2018-2024 © 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.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

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 NOT? 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.