Forum Discussion

Dicken's avatar
Dicken
Post Prodigy
2 years ago
Solved

DAX contains

 

 

Hi, I will try to keep this as simple as i can I have a four column table a,b,c,d, and at least one row of each has the word cat or dog, 

If I write a measure 

CONTAINS( Table2, Table2[A], "dog")

for any columns I will get a true, but if i write 

CONTAINS( Table2, Table2[A], "dog",Table2[B], "dog", Table2[C], "cat",Table2[D] ,"cat"

I get a false, indvidually they all get true, the syntax in docs ; 

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

so why do I get a false?   I'm new to this site, would it be better to use the insert code for the above ? 

 

Richard

  • hello,

    i think like that you check row by row, so you need to have in the same row Table2[A], "dog",Table2[B], "dog", Table2[C], "cat",Table2[D] ,"cat".

     

    Do you have a row where all those conditions are met?

  • I have realised that it refers to a row all being true not just any row of each column being true. 
    Richard 

3 Replies

  • Dicken's avatar
    Dicken
    Post Prodigy

    I have realised that it refers to a row all being true not just any row of each column being true. 
    Richard 

  • hello,

    i think like that you check row by row, so you need to have in the same row Table2[A], "dog",Table2[B], "dog", Table2[C], "cat",Table2[D] ,"cat".

     

    Do you have a row where all those conditions are met?

    • Dicken's avatar
      Dicken
      Post Prodigy

      Yes, I had  just tried that , refrshed and it became true, thanks for the repsonse.