Forum Discussion

YGoe's avatar
YGoe
New Member
9 years ago
Solved

Search text DAX not working

Dear All, 

 

I am trying to perform an if test on a column that contains strings. After searching the web, I decided to use the search function. 

I keep running in an error telling me that a single value cannot be determined (please see snap shot below) I know for a fact that what I am looking for does exist and only appears once in the entire database! the function is here :


test = if(SEARCH("Transient Retail",'home accounts'[acc_name],,0)<>0,10,0)

 

Many thanks, 

 

  • Is home accounts{acc_name] already a calculated column?

     

    Try this one as a column

     

    test = IF(IFERROR(SEARCH("Transient Retail",'home accounts'[acc_name]),-1)=1,10,0)

     

15 Replies

  • sokg's avatar
    sokg
    Solution Supplier

    Hi YGoe

     

    Try this instead

     

    test = IF(IFERROR(SEARCH("Transient Retail",'home accounts'[acc_name],-1)=1,10,0)

     

    Note this:   The search function is case insensitive

    • YGoe's avatar
      YGoe
      New Member

       Hi sokg,

       

      I tried what you proposed and the error remains.

      there is an error that is linked to the column 'home accounts'[acc_name] as it has a red line underneath it. 

       

      I honestly do not know why. You may find below a snapshot of the table accounts

       

      • sokg's avatar
        sokg
        Solution Supplier

        Could you give a print screen from the error you get with my formula