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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors