IN Operator / CONTAINSROW function (DAX)

How does the IN Operator / CONTAINSROW function (DAX) work?

IN Operator / CONTAINSROW function (DAX) returns TRUE if a value row exists or is included in a table, otherwise FALSE returns. Except for syntax, the IN operator and CONTAINSROW function are functionally equivalent.

IN Operator Formula Syntax

<scalarExpr> IN <tableExpr> ( <scalarExpr1>, <scalarExpr2>, … ) IN <tableExpr>

CONTAINSROW Formula Syntax

CONTAINSROW (<tableExpr>, <scalarExpr>[, <scalarExpr>, …])

How do you use the IN Operator / CONTAINSROW function?

The IN operator internally executes CONTAINSROW.

Related Blog Posts

Related Support Forum Posts

How to use measure as a slicer
Multi Criteria, IF and contains
How to filter column with values that are IN and that are Not in another column of same table

Considerations when using the IN Operator / CONTAINSROW function

The number of scalarExprN must match the number of columns in tableExpr.

Unlike the = operator, the IN operator and the CONTAINSROW function perform strict comparison. For example, the BLANK value does not match 0.

NOT IN is not an operator in DAX. To perform the logical negation of the IN operator, put NOT in front of the entire expression.

Related Video Tutorials

EDNA TV-Unique subtotal
EDNA TV-Harvesting a slicer selection

Formula examples using the IN Operator / CONTAINSROW function

EVALUATE FILTER(ALL(DimProduct[Color]), [Color] IN { "Red", "Yellow", "Blue" })
ORDER BY [Color]
EVALUATE FILTER(ALL(DimProduct[Color]), CONTAINSROW({ "Red", "Yellow", "Blue" }, [Color]))
ORDER BY [Color]

Related DAX Functions

FALSE
NOT

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI

DOWNLOAD

To access our comprehensive DAX formula reference guide just insert your email address below. The resource will download immediately and we’ll also email it to you.