CONTAINS Function (DAX)

How does the CONTAINS function (DAX) work?

The CONTAINS function (DAX) returns true if values for all referred columns exist, or are contained, in those columns; otherwise, the function returns false.

CONTAINS Formula Syntax

CONTAINS (
     <table>, <columnName>, <value> [, <columnName>, <value>]…
)

How do you use the CONTAINS function?

Used within another function to search for a character or string. Returns true if found, false if not found.

Related Blog Posts

Related Support Forum Posts

Understanding DAX Formula
Developing Complex Dax functions

Considerations when using the CONTAINS function

  • The arguments columnName and value must come in pairs; otherwise an error is returned.
  • columnName must belong to the specified table, or to a table that is related to table.
  • If columnName refers to a column in a related table then it must be fully qualified; otherwise, an error is returned.

Related Video Tutorials

Formula examples using the CONTAINS function

=CONTAINS(InternetSales, [ProductKey], 214, [CustomerKey], 11185)

COUNTROWS ( FILTER ( table, columnName = value ) ) > 0

CALCULATE ( [measure], FILTER ( ALL ( targetTable[targetColumn] ), CONTAINS ( VALUES ( sourceTable[sourceColumn] ), sourceTable[sourceColumn], targetTable[targetColumn] ) ) )

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.