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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
abeirne
Helper II
Helper II

Sorting usable customer emails from non-usable emails

Hi all, I have a large collection of customer emails, and I need to sort them from emails that are usable and those that are not. I have them all in one column, and I would like to search that column for text value "@" and ".com". This is because some of the values in the email column do not include these values, and so they aren't usable. For example, I want to gather all emails like 
"acb1234@gmail.com"
"tiger67@yahoo.com"
"78steelers@aol.com"
And not anything else, like phone numbers, blanks, or non-email addresses. Is there a way to do this? Let me know if you need additional information, thank you

1 ACCEPTED SOLUTION

@abeirne , Sorry Syntax issue .

correct one is

if Text.Contains([Column1],"@") and Text.Contains([Column1],".com") then 1 else 0

 

 

M test code

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSnRITErWS87PVYrViVZKcUgB8vJSS8C85LIkMG1oZKwUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([Column1],"@") and Text.Contains([Column1],".com") then 1 else 0)
in
#"Added Custom"

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@abeirne ,  You can use filter in power query. USe custom option and use OR

 

or create a column like this

if Text.Contains("@",[Col])  or  Text.Contains(".com",[Col])  then 1 else 0

 

and filter row having value of this column =1  in power query

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

if Text.Contains("@",[Customer_Email_Address]) or
Text.Contains(".com", [Customer_Email_Address]) then [Customer_Email_Address] else "BBBB"

Unfornately that is only resulting in BBBB, I am not sure why, even when I change the 'or' to 'and'.

I also have this which is semi-working:
if List.AnyTrue(List.Transform( { "@" , ".com"}, (substring) => Text.Contains( [Customer_Email_Address], substring ) ) ) = true then [Customer_Email_Address] else "BBBBBB")

How to I add "and" in this? Right now it is pulling both values, resulting in outputs like "@DENIED" and other incorrect email addresses. Thank you for your help in this. 

@abeirne , Sorry Syntax issue .

correct one is

if Text.Contains([Column1],"@") and Text.Contains([Column1],".com") then 1 else 0

 

 

M test code

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSnRITErWS87PVYrViVZKcUgB8vJSS8C85LIkMG1oZKwUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([Column1],"@") and Text.Contains([Column1],".com") then 1 else 0)
in
#"Added Custom"

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi thank you very much. Is there a way I can make a list of things not to include in results, as well as including and Text.Contains([Column1],"@"), etc?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.