DAX Logical - AND function



Description

Checks the two arguments if they are TRUE or FALSE, and returns TRUE only when both are TRUE. Otherwise, returns FALSE.

Syntax

AND (<logical1>, <logical2>) 

Parameters

Parameter Description
logical1 Logical values that you want to test.
logical2

Return Value

  • TRUE, if both the arguments are TRUE.
  • FALSE, otherwise.

Remarks

AND function takes only two arguments. If you have more than two arguments, either nest the AND functions or use the DAX logical operator &&.

Example

= AND([Country] = "USA",[Medal] = "Gold") 

This DAX formula returns a calculated column with TRUE for Country – USA and Medal – Gold values, and FALSE otherwise.

USA Gold Medal Count:= SUMX(
   Results,IF(AND([Country] = "USA",[Medal] = "Gold") = TRUE(),1,0)
) 

This DAX formula returns a calculated field with total number of Gold Medals for USA.

dax_functions_logical.htm
Advertisements