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
harrinho
Helper III
Helper III

IF Contains

Hi guys, 

 

Is there any easy way to dax the following statement? 

 

I want to cleate a column which will flag with "1" if the text of the value in "Project Name" column contains the word "RFR" 

 

Is that doable? 

1 ACCEPTED SOLUTION
Smauro
Solution Sage
Solution Sage

Hey @harrinho,

Sure it is, just add a new column using a conditional over the SEARCH funcion with a return 0 if it doesn't find it:

RFRTest =
VAR n = SEARCH ( "RFR", [Project Name],, 0 ) RETURN IF ( n > 0, 1, 0 )

Or, if you want to play it smart and not use a conditional:

RFRTest =
VAR n =
    SEARCH ( "RFR", [Project Name],, 0 )
RETURN
    n
        / (
            ABS ( n - 1 )
                + 1
        )

 

 

 

 

 

 




Feel free to connect with me:
LinkedIn

View solution in original post

1 REPLY 1
Smauro
Solution Sage
Solution Sage

Hey @harrinho,

Sure it is, just add a new column using a conditional over the SEARCH funcion with a return 0 if it doesn't find it:

RFRTest =
VAR n = SEARCH ( "RFR", [Project Name],, 0 ) RETURN IF ( n > 0, 1, 0 )

Or, if you want to play it smart and not use a conditional:

RFRTest =
VAR n =
    SEARCH ( "RFR", [Project Name],, 0 )
RETURN
    n
        / (
            ABS ( n - 1 )
                + 1
        )

 

 

 

 

 

 




Feel free to connect with me:
LinkedIn

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.