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! Learn more

Reply
mahenkj2
Solution Sage
Solution Sage

Comparing two tables on multiple column resulting full match and partial match

Hi,

 

I am trying to find a solution for below scenario:

 

There are two table. 

Table-1     
IDNameInvoice NumberInvoice amountTax rateTax amount
AA0JohnAax/2359104005%520
AB0AlbertBbc/231520012%1824
AA0JohnCCd/231500018%2700
BB0StephyBFG/5422800018%5040

 

Table-2     
IDNameInvoice NumberInvoice amountTax rateTax amount
AA0John2359104005%520
AB0AlbertBbc/231520012%1824
AA0JohnCCd/23150005%750
CDFKelleyASG/542312005%60

 

Aim is to find the match in both the tables by comparing ID+Name+Invoice Number +Invoice Amount+Tax rate. If such combinations are matched in both the tables, it will be like 'full match'.

 

But if say for one entry, invoice number is wrong due to some reason, but still ID+Name+Invoice Amount+Tax rate are matching and invoice number is partially matching, we will term as 'partial match'.

 

It is also possible that, one table have some entry which is not present in another, then we term it as 'Not in Table-1' or 'Not in Table-2'.

 

I reproduce the expected output as well below:

 

Intended result             
 Table-1 dataTable-2 dataDifference
IDNameTable-1-Invoice numberTable-1-Invoice amountTable-1-Tax rateTable-1-Tax amountTable-2-Invoice NumberTable-2-Invoice amountTable-2-Tax rateTable-2-Tax amountResultInvoice numberInvoice amountTax rateTax amount
AA0JohnAax/2359104005%5202359104000.05520Partial matchMismatch   
AB0AlbertBbc/231520012%1824Bbc/231520012%1824Match    
AA0JohnCCd/231500018%2700CCd/23150005%750Partial match  MismatchMismatch
BB0StephyBFG/5422800018%5040    Not in Table-1    
CDFKelley    ASG/542312005%60Not in Table-2    

 

Similary it is possible that ID+Name+Invoice Number +Invoice Amount are matching for an entry in both the tables but tax rate is wrong/mismatch and we mark it as partial match for Tax rate mismatch.

 

So, it is kind of comparing multiple columns.

 

I have done much work on this problem in power query but multiple column comparison is a challenge for me so far.

 

Any help is much appreciated.

1 ACCEPTED SOLUTION
jpessoa8
Continued Contributor
Continued Contributor

@mahenkj2 ,

 

The key to this issue is the usage of the Fuzzy Merge. This allow the Merge of the two tables by the fields ID, Name and Invoice Number but allowing a match of at least 80% (value by default but can be edited) and ignoring case and spaces.

 

jpessoa8_0-1700850589821.png

 

With this Fuzzy Merge with a Full Outer kind you can afterwards compare each combinations and also find if a record is only on one the tables:

 

jpessoa8_2-1700851004144.png

 

Final result:

 

jpessoa8_1-1700850792180.png

 

Here is a link with the PowerBI file used : https://we.tl/t-DDvMm0z6Wb

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudo 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Jorge Pessoa

View solution in original post

4 REPLIES 4
jpessoa8
Continued Contributor
Continued Contributor

Hi @mahenkj2 ,

 

I think I'll be able to create a solution in PowerQuery based on GroupBy's. The issue is, when you have partial matches, since you will only display 1 row, which criteria should be use to identify?

 

Table1

AA0JohnAax/2359104005%520

 

Table2

AA0John2359       104005%520

 

The difference is on Invoice Number. Which one is going to be displayed?

Thanks.

Since there is a partial match in invoice number, but other things are matching, so I would like the result as shown in intended result:

 

mahenkj2_0-1700845081753.png

 

Table-1 Invoice number is Aax/2359, whereas table-2 shows 2359, and since other items ID+Name+Tax rate is matching in both table. The result will be a partial match.

 

 

jpessoa8
Continued Contributor
Continued Contributor

@mahenkj2 ,

 

The key to this issue is the usage of the Fuzzy Merge. This allow the Merge of the two tables by the fields ID, Name and Invoice Number but allowing a match of at least 80% (value by default but can be edited) and ignoring case and spaces.

 

jpessoa8_0-1700850589821.png

 

With this Fuzzy Merge with a Full Outer kind you can afterwards compare each combinations and also find if a record is only on one the tables:

 

jpessoa8_2-1700851004144.png

 

Final result:

 

jpessoa8_1-1700850792180.png

 

Here is a link with the PowerBI file used : https://we.tl/t-DDvMm0z6Wb

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudo 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Jorge Pessoa

Hi @jpessoa8 ,

 

I am giving it a try on real dataset, but after looking at your example, I feel thats good way to do it.

 

Thanks again.

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.

Top Solution Authors