Forum Discussion
harrinho
8 years agoHelper 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?
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 )
1 Reply
- SmauroSolution 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 )