Forum Discussion
Compare Two Columns and Check for Partial Match
- 6 years ago
Hi, Jenni-Sky
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create a calculated column as below.
Match = var _cname = 'Table'[Customer Name] var _iname = 'Table'[Invoice Customer] var _firstname = LEFT(_cname,SEARCH(" ",_cname)-1) var _lastname = MID(_cname,SEARCH(" ",_cname)+1,LEN(_cname)) return IF( EXACT([Customer Name],[Invoice Customer]), "Match", IF( NOT(CONTAINSSTRING(_iname,_firstname))&&NOT(CONTAINSSTRING(_iname,_lastname)), "Not Match", IF( CONTAINSSTRING(_iname,_firstname)||CONTAINSSTRING(_iname,_lastname), "Partial Match" ) ) )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
"To a hammer, the whold world is a nail"
I bet you're going to get some "nail" type answers in this Power BI forum because everyone here is a hammer.
But really, Power BI is not the tool for this. Try Fuzzy Matching in SSIS. Or if you have it in a SQL database, maybe you can write some code that will iterate over the two datasets looking for similarities, maybe using regular expressions and the like.
But really, you're asking hammer and nail people for a solution when you really need an electrician. 🙂