# DAX Language - AND and OR Functions

A-Badde | Posted on April 10, 20

AND Function

Description:

The AND function checks whether all arguments are TRUE, and returns TRUE if all arguments are TRUE.

Return Value:

AND returns a single boolean value depending on the combination of values that you test.

Syntax:

``AND( <Logical1>,<Logical2> )``
• Description of the parameters:

PARAMETER

DESCRIPTION

Logical1

The logical values to test

Logical2

The logical values to test

Example:

As an example, we would like to create a measure that returns "Good" if the sales amount is greater than 100.000.000 and the quantity is greater than 400.000 otherwise Blank. We can achieve this using the following formula:

``````AND_Measure =
IF(
AND(SUM(Sales[SalesAmount])>100000000,SUM(Sales[SalesQuantity])>400000),
"Good",
BLANK()
)``````

The AND function accepts only two arguments. In case there are three or more conditions to evaluate use the operator '&&'. By adding a third condition to the previous formula, it now becomes:

``````Measure =
IF(
SUM(Sales[SalesAmount])>100000000
&& SUM(Sales[SalesQuantity])>400000
&& SUM(Sales[UnitPrice])>20000,
"Good",
BLANK()
)``````

OR Function

Description:

The OR function checks whether one of the arguments is TRUE to return TRUE. The function returns FALSE if both arguments are FALSE.

Return Value:

OR returns a single boolean value depending on the combination of values that you test.

Syntax:

``OR( <Logical1>,<Logical2> )``
• Description of the parameters:

PARAMETER

DESCRIPTION

Logical1

The logical values to test

Logical2

The logical values to test

Example:

We will use the previous example, but this time we want to display "Good" if the sales amount is greater than 100.000.000 or the quantity is greater than 400.000 otherwise Blank. We can achieve this using the following formula:

``````AND_Measure =
IF(
OR(SUM(Sales[SalesAmount])>100000000,SUM(Sales[SalesQuantity])>400000),
"Good",
BLANK()
)``````

The OR function accepts only two arguments. In case there are three or more conditions to evaluate use the operator '||'. By adding a third condition to the previous formula, it now becomes:

``````Measure =
IF(
SUM(Sales[SalesAmount])>100000000
|| SUM(Sales[SalesQuantity])>400000
|| SUM(Sales[UnitPrice])>20000,
"Good",
BLANK()
)``````

Related Video: ###### (0) Comments

There is no comment

##### Recent Posts
###### DAX Language - CONTAINS Function
A-Badde | May 09, 20

The CONTAINS function returns a boolean value, TRUE if each ...Read More

###### DAX Language - RANKX Function
A-Badde | May 05, 20

The RANKX function returns a single integer value that repre...Read More

###### DAX Language - AND and OR Functions
A-Badde | April 10, 20

AND/OR functions check whether all arguments are TRUE or one...Read More

###### DAX Language - Variables in DAX
A-Badde | April 10, 20

Use Var keyword to store the result of an expression as a na...Read More