Forum Discussion

Aknas's avatar
Aknas
Frequent Visitor
3 years ago
Solved

string contains another column flag

Hi - I was looking if this is possible in power bi .

 

 

above is a sample excel file that shows the result ( formula) - Looking similar solution in PB

 

Thanks

  • Hi Aknas 

     

    Download example PBIX file

     

    If you want a column try this

     

    Flag = IF(CONTAINSSTRING([Full],[Partial]),"Yes","No")

     

     

    If you want a measure, try this

    Flag Measure = IF(CONTAINSSTRING(SELECTEDVALUE('DataTable'[Full]),SELECTEDVALUE('DataTable'[Partial])),"Yes","No")

     

     

    If you are happy with a Boolean result for the flag, rather than text, you can just use, e.g.

    CONTAINSSTRING(SELECTEDVALUE('DataTable'[Full]),SELECTEDVALUE('DataTable'[Partial]))

     

    and it returns True or False, no need for the IF to return "yes" or "no".  This works for both the column and measure.

     

    Regards

     

    Phil

2 Replies

  • Hi Aknas 

     

    Download example PBIX file

     

    If you want a column try this

     

    Flag = IF(CONTAINSSTRING([Full],[Partial]),"Yes","No")

     

     

    If you want a measure, try this

    Flag Measure = IF(CONTAINSSTRING(SELECTEDVALUE('DataTable'[Full]),SELECTEDVALUE('DataTable'[Partial])),"Yes","No")

     

     

    If you are happy with a Boolean result for the flag, rather than text, you can just use, e.g.

    CONTAINSSTRING(SELECTEDVALUE('DataTable'[Full]),SELECTEDVALUE('DataTable'[Partial]))

     

    and it returns True or False, no need for the IF to return "yes" or "no".  This works for both the column and measure.

     

    Regards

     

    Phil

    • Aknas's avatar
      Aknas
      Frequent Visitor

      Thanks Philip - All worked.