Share via


AND Function (DAX)

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

AND(<logical1>,<logical2>)

Parameters

Term

Definition

logical_1, logical_2

The logical values you want to test.

Property Value/Return Value

Returns true or false depending on the combination of values that you test.

Example

The following formula shows the syntax of the AND function.

=IF(AND( AND( 10 > 9, -10 < -1), true), "All true", "One or more false"

Because all three conditions passed as arguments to the ALL function are true, the formula returns "All True".

The following sample uses the AND function with nested formulas to compare two sets of calculations at the same time. For each product category, the formula determines if the current year sales and previous year sales of the Internet channel are larger than the Reseller channel for the same periods. If both conditions are true, for each category the formula returns the value, "Internet hit".

AND function

Column Labels

 

 

 

 

 

Row Labels

2001

2002

2003

2004

 

Grand Total

Bib-Shorts

 

 

 

 

 

 

Bike Racks

 

 

 

 

 

 

Bike Stands

 

 

 

Internet Hit

 

 

Bottles and Cages

 

 

 

Internet Hit

 

 

Bottom Brackets

 

 

 

 

 

 

Brakes

 

 

 

 

 

 

Caps

 

 

 

 

 

 

Chains

 

 

 

 

 

 

Cleaners

 

 

 

 

 

 

Cranksets

 

 

 

 

 

 

Derailleurs

 

 

 

 

 

 

Fenders

 

 

 

Internet Hit

 

 

Forks

 

 

 

 

 

 

Gloves

 

 

 

 

 

 

Handlebars

 

 

 

 

 

 

Headsets

 

 

 

 

 

 

Helmets

 

 

 

 

 

 

Hydration Packs

 

 

 

 

 

 

Jerseys

 

 

 

 

 

 

Lights

 

 

 

 

 

 

Locks

 

 

 

 

 

 

Mountain Bikes

 

 

 

 

 

 

Mountain Frames

 

 

 

 

 

 

Panniers

 

 

 

 

 

 

Pedals

 

 

 

 

 

 

Pumps

 

 

 

 

 

 

Road Bikes

 

 

 

 

 

 

Road Frames

 

 

 

 

 

 

Saddles

 

 

 

 

 

 

Shorts

 

 

 

 

 

 

Socks

 

 

 

 

 

 

Tights

 

 

 

 

 

 

Tires and Tubes

 

 

 

Internet Hit

 

 

Touring Bikes

 

 

 

 

 

 

Touring Frames

 

 

 

 

 

 

Vests

 

 

 

 

 

 

Wheels

 

 

 

 

 

 

 

 

 

 

 

 

 

Grand Total

 

 

 

 

 

 

= IF( AND(  SUM( 'InternetSales_USD'[SalesAmount_USD])
           >SUM('ResellerSales_USD'[SalesAmount_USD])
          , CALCULATE(SUM('InternetSales_USD'[SalesAmount_USD]), PREVIOUSYEAR('DateTime'[DateKey] )) 
           >CALCULATE(SUM('ResellerSales_USD'[SalesAmount_USD]), PREVIOUSYEAR('DateTime'[DateKey] ))
          )
     , "Internet Hit"
     , ""
     )

See Also

Other Resources

Logical Functions (DAX)