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
k943
Helper I
Helper I

develop smart algorithm for customer service email response

I am trying to make 2 columns that determine whether each email transaction of a case is from customer to company or from company to customer. Here is a sample picture:

k943_0-1668491519748.png

for example case ID#1, Andy the customer emailed customerservice Rep1 , so Yes in "From Customer to Company", but customer service Rep 1 forwarded the email to salesdepartment, so No and No for both columns. Then, Rep 2 emailed three people: Rep1, sales department (like cc), and Andy. So the third record has a Yes in From Company to Customer.

 

Any help is very much appreciated.

1 ACCEPTED SOLUTION

Hi @k943 ,

Sorry for late back. According to your description, I moidfy the sample and the formula:

From Customer to Company =
IF (
    NOT ( CONTAINSSTRING ( 'Table'[From Address], "@phoenix.com" ) )
        && CONTAINSSTRING ( 'Table'[To Address(xxx@company.com)], "@phoenix.com" ),
    "Yes",
    "No"
)
From Company to Customer =
IF (
    CONTAINSSTRING ( 'Table'[From Address], "@phoenix.com" )
        && NOT ( CONTAINSSTRING ( 'Table'[To Address(xxx@company.com)], "@phoenix.com" ) ),
    "Yes",
    "No"
)

Result:

vkalyjmsft_0-1669183326369.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
k943
Helper I
Helper I

thank you. I realize in real life, there are hundreds of different customers emailing to my company, so their email addresses vary (i.e. xxx@companyA.com, xxx@firmB.com, xxx@organizationC.com, etc).

In that case, the formula will not work  ecause each case ID is generated by different customers and they all have different email addresses.

How do you take this factor when developing the custom columns? thank you very much.

Hi @k943 ,

Then what is the logic that distinguishes customers from companies. I mean, if we just handle it manually, what are the standards.

Best Regards,
Community Support Team _ kalyj

hi,

for example,  my company (company name is phoenix, for example) has these addresses: steel.customerservice.america@phoenix.com, and salessupport.america@phoenix.com, and customer service representatives' individual email like: andy.lynch@phoenix.com, kathy.beckman@phoenix.com, etc

 

so basically, everything else that does not contain "phoenix" after @ is from the customer (i.e. xxx@deltagroup.com, xxx@sapen-mineral.com)

 

thank you very much.

Hi @k943 ,

Sorry for late back. According to your description, I moidfy the sample and the formula:

From Customer to Company =
IF (
    NOT ( CONTAINSSTRING ( 'Table'[From Address], "@phoenix.com" ) )
        && CONTAINSSTRING ( 'Table'[To Address(xxx@company.com)], "@phoenix.com" ),
    "Yes",
    "No"
)
From Company to Customer =
IF (
    CONTAINSSTRING ( 'Table'[From Address], "@phoenix.com" )
        && NOT ( CONTAINSSTRING ( 'Table'[To Address(xxx@company.com)], "@phoenix.com" ) ),
    "Yes",
    "No"
)

Result:

vkalyjmsft_0-1669183326369.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yanjiang-msft
Community Support
Community Support

Hi @k943 ,

According to your description, here's my solution. Create two calculated columns.

From Customer to Company =
IF (
    CONTAINSSTRING ( 'Table'[From Address], "@gmail.com" )
        && CONTAINSSTRING ( 'Table'[To Address(xxx@company.com)], "@company.com" ),
    "Yes",
    "No"
)
From Company to Customer =
IF (
    CONTAINSSTRING ( 'Table'[From Address], "@company.com" )
        && CONTAINSSTRING ( 'Table'[To Address(xxx@company.com)], "@gmail.com" ),
    "Yes",
    "No"
)

Get the correct result:

vkalyjmsft_0-1668579403091.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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