Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
adityavighne
Continued Contributor
Continued Contributor

2 conditions - Conditional column

Hi,

 

I want to create a conditional column with below conditions – how to create this?

 

  1. PageURL - contains – abc AND PageURL - contains – def

OR

     2.PageURL - contains – ghi AND PageURL - contains – jkl

 

I don’t want to add 2 times PageURL in my filter section, because it’s not giving correct results

1 ACCEPTED SOLUTION

@adityavighne 

 

Flag = 
       IF( 
             (SEARCH("abc",Test256Search[Name],,0)>0 && SEARCH("def",Test256Search[Name],,0)>0)
          || (SEARCH("ghi",Test256Search[Name],,0)>0 && SEARCH("jkl",Test256Search[Name],,0)>0)
          ,"Y","N"
         )

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

7 REPLIES 7
v-cherch-msft
Employee
Employee

Hi @adityavighne 

 

Kindly mark the helpful answer as a solution if you feel that makes sense.If not,please share more data and your expected output.

 

Regards,

Cherie

 

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PattemManohar
Community Champion
Community Champion

@adityavighne  Please try this as a New column in Data pane using below DAX

 

Flag = IF(
             (SEARCH("abc",Table[PageURL])>0 && SEARCH("def",Table[PageURL])>0)
          || (SEARCH("ghi",Table[PageURL])>0 && SEARCH("jkl",Table[PageURL])>0)
          ,"Y","N"
         )




Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




thanks for the reply.

 

I'm getting below error -

"The search Text provided to function 'SEARCH' could not be found in the given text.

The search function given an error when the condition provided is not valid. Wrap it in ISERROR function to capture the error. 

 

Something like this:

 

Flag = IF(
             iserror((SEARCH("abc",Table[PageURL])>0 && SEARCH("def",Table[PageURL])>0))=false()
          || iserror((SEARCH("ghi",Table[PageURL])>0 && SEARCH("jkl",Table[PageURL])>0))=false()
          ,"Y","N"
         )

 

 

 

iserror gives boolean value - which will not resolve my problem.

I resolve this issue - 

 

Flag = SEARCH("abc",[Pages],1,BLANK() && SEARCH("def",[Pages],1,BLANK()))
           || SEARCH("ghi",[Pages],1,BLANK() && SEARCH("jkl",[Pages],1,BLANK()))

@adityavighne 

 

Flag = 
       IF( 
             (SEARCH("abc",Test256Search[Name],,0)>0 && SEARCH("def",Test256Search[Name],,0)>0)
          || (SEARCH("ghi",Test256Search[Name],,0)>0 && SEARCH("jkl",Test256Search[Name],,0)>0)
          ,"Y","N"
         )

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.