CONTAINSROW DAX Function (Information)

Returns TRUE if there exists at least one row where all columns have specified values.


CONTAINSROW ( <Table>, <Value> [, <Value> [, … ] ] )
Parameter Attributes Description

The table to test.

Value Repeatable

A scalar expression to look for in the corresponding column.

Return values

Scalar A single boolean value.

A value of TRUE if a row of values exists in a table; otherwise, the function returns FALSE.


The IN operator internally executes CONTAINSROW.

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. For example:

NOT [Color] IN { "Red", "Yellow", "Blue" }

The following expressions are equivalent:

Product[Color] IN { "Red", "Blue", "Yellow" }
CONTAINSROW ( { "Red", "Blue", "Yellow" }, Product[Color] )

The following expressions using two columns are equivalent:

( 'Date'[Year], 'Date'[MonthNumber] ) IN { ( 2018, 12 ), ( 2019, 1 ) }
CONTAINSROW ( { ( 2018, 12 ), ( 2019, 1 ) }, 'Date'[Year], 'Date'[MonthNumber] )
» 1 related article


--  CONTAINSROW requires to specify one value  
--  for each column of the lookup table.
DEFINE MEASURE Sales[Customers without stores] = 
        FILTER (
            NOT CONTAINSROW (
                SUMMARIZE ( Store, Store[CountryRegion], Store[City] ),
    "Customers", COUNTROWS ( Customer ),
    "Customers without stores", [Customers without stores]
CountryRegion Customers Customers without stores
Australia 3,631 3,524
United States 8,086 7,362
Canada 1,579 1,381
Germany 1,791 1,668
United Kingdom 1,931 1,271
France 1,814 1,426
the Netherlands 1 (Blank)
Greece 1 (Blank)
Switzerland 1 (Blank)
Ireland 1 (Blank)
Portugal 1 (Blank)
Spain 1 (Blank)
Italy 1 (Blank)
Russia 2 (Blank)
Poland 1 (Blank)
Turkmenistan 1 (Blank)
Thailand 1 (Blank)
China 5 (Blank)
Kyrgyzstan 1 (Blank)
South Korea 2 (Blank)
Syria 1 (Blank)
Pakistan 1 (Blank)
India 3 (Blank)
Japan 7 1
Singapore 1 (Blank)
Taiwan 1 (Blank)
Iran 1 (Blank)
Bhutan 1 (Blank)
Armenia 1 (Blank)
--  Internally, the IN operator invokes a corresponding
--  CONTAINSROW filter.
--  The CONTAINSROW function has as many arguments after the
--  first one as the number of column in each row of the table
--  passed in the first argument. Only IN uses the tuples syntax
     ( 1, "IN", COUNTROWS (
        FILTER (
             ( Customer[City], Customer[State] )
                IN { ( "New York", "New York" ), ( "Columbus", "Ohio" ) }
    ) ),
        FILTER (
            CONTAINSROW (
                { ( "New York", "New York" ), ( "Columbus", "Ohio" ) },
    ) )
Value1 Value2 Value3
1 IN 2

Related articles

Learn more about CONTAINSROW in the following articles:

  • The IN operator in DAX

    This article describes the IN operator in DAX, which simplifies logical conditions checking whether a certain value is included in a list of values or expressions. » Read more

Last update: Sep 14, 2023   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber

Microsoft documentation:

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


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.


This function is deprecated. Jump to the Alternatives section to see the function to use.


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


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.


Want to improve the content of CONTAINSROW? 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.