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.
Hi All,
I am using the containstring function to search a column to see if any cell results has "ABC" in..
I also want to check, in the same measure if the same column containstring "EFG"..
I have tried the || (or) inbetween the "ABC" || "EFG" but this does not work.
Looking forward to some help.
Regards
Rob
Solved! Go to Solution.
CONTAINSSTRING returns a Boolean (e.g. True or False). If you want to use it in a IF statement, you can use :
Check = IF(CONTAINSSTRING("ABC") || CONTAINSSTRING("EGF"), TRUE, FALSE)
Note the double 's' in containSString by the way 🙂
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Hi @Anonymous
Sorry, my initial post wan't completely clear.
You can use either option as the logical test inside your IF statement and they would yeild the same result.
It's worth noting that the OR function only accepts 2 arguments so if you have more than 2, you would need to use nested OR functions.
As a result, I tend to opt for the 'or' operator '||' as I find it easier to read.
What I was trying to get across in my previous post is that each argument has to be a valid logical test in its own right.
So, you can't use:
Column =
IF (
CONTAINSSTRING ( Table1[Column1], "ABC" || "EFG" ),
"Yes",
"No
)
But instead have to use:
Column =
IF (
CONTAINSSTRING ( Table1[Column1], "ABC" ) || CONTAINSSTRING ( Table1[Column1], "EFG" ),
"Yes",
"No
)
Hope it helps.
Best regards,
Martyn
If I answered your question, please help others by accepting it as a solution.
Hi @Anonymous
You need to write the table and column reference for both conditions:
E.g.
--Using 'or' operator
CONTAINSSTRING ( Table1[Column1], "ABC" ) || CONTAINSSTRING ( Table1[Column1], "EFG" )
-- Using OR function
OR ( CONTAINSSTRING ( Table1[Column1], "ABC" ), CONTAINSSTRING ( Table1[Column1], "EFG" ) )
Best regards,
Martyn
If I answered your question, please help others by accepting it as a solution.
Hi @Anonymous
Sorry, my initial post wan't completely clear.
You can use either option as the logical test inside your IF statement and they would yeild the same result.
It's worth noting that the OR function only accepts 2 arguments so if you have more than 2, you would need to use nested OR functions.
As a result, I tend to opt for the 'or' operator '||' as I find it easier to read.
What I was trying to get across in my previous post is that each argument has to be a valid logical test in its own right.
So, you can't use:
Column =
IF (
CONTAINSSTRING ( Table1[Column1], "ABC" || "EFG" ),
"Yes",
"No
)
But instead have to use:
Column =
IF (
CONTAINSSTRING ( Table1[Column1], "ABC" ) || CONTAINSSTRING ( Table1[Column1], "EFG" ),
"Yes",
"No
)
Hope it helps.
Best regards,
Martyn
If I answered your question, please help others by accepting it as a solution.
CONTAINSSTRING returns a Boolean (e.g. True or False). If you want to use it in a IF statement, you can use :
Check = IF(CONTAINSSTRING("ABC") || CONTAINSSTRING("EGF"), TRUE, FALSE)
Note the double 's' in containSString by the way 🙂
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |