Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

IF CONTAINS WITH OR/AND

Hello,

 

My goal is to get the counts based on two criteria using CONTAINSSTRING for two different columns: "Return Type" and "Request Type"

 

Return Type containing "KBA"

Request Type containing "Selective Recall"

 

I am stuck with the formula of getting the number of strings with "KBA" only. How do I add the logic to get the number of "Selective Recall" from Request Type as well. Is this OR or AND?

 

Current formula:

 IF(CONTAINSSTRING(table1[Return Type],"KBA"),1,0)

 

Please help thanks!

 
  • Anonymous , Like

    IF(CONTAINSSTRING(table1[Return Type],"KBA") || CONTAINSSTRING(table1[Selective Recall],"KBA") ,1,0)

     

    or

     

    IF(CONTAINSSTRING(table1[Return Type],"KBA") && CONTAINSSTRING(table1[Selective Recall],"KBA") ,1,0)

2 Replies

  • Anonymous , Like

    IF(CONTAINSSTRING(table1[Return Type],"KBA") || CONTAINSSTRING(table1[Selective Recall],"KBA") ,1,0)

     

    or

     

    IF(CONTAINSSTRING(table1[Return Type],"KBA") && CONTAINSSTRING(table1[Selective Recall],"KBA") ,1,0)

  • Try it like this. "||" is OR.

    IF (
        CONTAINSSTRING ( table1[Return Type], "KBA" ) ||
        CONTAINSSTRING ( table1[Request Type], "Selective Recall" ),
        1,
        0
    )