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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
gauravnarchal
Post Prodigy
Post Prodigy

How can I use IF and Contains together

Hello - How can I use IF and Contains together when writing a dax?

 

So the dax should be

 

IF table 1 , coulmn email contains "@gmail.com" then return "Gmail" else other

 

Table 1

 

Email
ggg@gmail.com
nnn@yahoo.com
kkk@apple.com
mmmm@bananna.com
kkkkk@pear.com
1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

As a calculated column:

Gmail? = IF(CONTAINSSTRING('Table 1'[Email], "gmail"), "gmail", "Other")

gmail col.jpg

As a measure:

gmail measure = 
IF(CONTAINSSTRING(MAX('Table 1'[Email]), "gmail"), "gmail", "other")

gmail measure.jpg

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

1 REPLY 1
PaulDBrown
Community Champion
Community Champion

As a calculated column:

Gmail? = IF(CONTAINSSTRING('Table 1'[Email], "gmail"), "gmail", "Other")

gmail col.jpg

As a measure:

gmail measure = 
IF(CONTAINSSTRING(MAX('Table 1'[Email]), "gmail"), "gmail", "other")

gmail measure.jpg

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors