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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
klu31415
Frequent Visitor

Dynamic Text Classification of Email Subject Lines using an additional Classification Table

I'm looking for a way to classify and return the value in another table based on whether the value in [table2](column1) is contained in the values of [table1](column1). In one table I'd have the subject line of each email and in the other, I would have the subject classifier that I'd expect to be contained in the subject line. I hope the below makes sense from a logic perspective. 

 

Logic

If [table1][subject] CONTAINS [table2](classifier)

THEN return [table2](classifier) in [table1](subject_classifier)

 

I've tried a few different variants of SWITCH + SEARCH statements and have been unable to figure out a way to return the actual classifier from table2 the most I've been able to do is hardcode in the expected text value output. The expected logic would allow classifications of email subjects to grow dynamically based on the data fed into table2 without the need to keep updating the hardcoded text strings. 

 

 

 

 

 

 

 

 

2 REPLIES 2
ImkeF
Community Champion
Community Champion

How shall multiple matches be handled? (Create new row for each match or concatenate them in one cell with delimters)

Is it correct that you want partial matches as well (so "apple" shall be returned for "pineapple") or just exact matches for the full word?

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

I would likely create separate DAX calculations for each of the subject_classifiers. So if I'm looking for a server name I'd look to that column in table2 but if I'm looking for another detail it would be held in a different column. So for my use case, I'd specifically want exact matches but I can see how partial matches would be helpful for other users. 

 

Any help on this would be great! 

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