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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Mederic
Post Patron
Post Patron

Identify the differences between 2 tables

  • Hello,

I would like to obtain the result shown in the screenshot below using the Table.RemoveMatchingRows formula:
I can't do it because there are the following steps to be carried out:
- match the column names
- multiply the Table2 column by -1
- and keep only the differences greater than or equal to -0.2 or 0.2

For information, my tables contain several thousand rows. 

Thanks in advance

Best regards


Différence.jpg

 

 

ID_1	Amount_1
23	345,34
45	726,71
14	234
54	62,58
66	245,28
58	58,56
45	100
823	762
77	62

 

 

 

ID_2	Amount_2
23	-345,34
45	-726,72
14	-234
66	-245,28
58	-38,88
45	-100
54	-62,6
77	-62
523	89

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

HI @Mederic 

 

Download example PBIX file

 

After importing both tables you can Append them.

 

mergeamt.png

 

Then Group by ID and choose Sum as the aggregation.

 

grpa1.pnggrpa2.png

 

Then remove Amounts you don't want

 

filta1.pngfilta2.png

 

Here's the query for the merge onwards

 

 

let
    Source = Table.Combine({Table1, Table2}),
    #"Grouped Rows" = Table.Group(Source, {"ID"}, {{"Sum", each List.Sum([Amount]), type nullable number}}),
    #"Filtered Rows" = Table.SelectRows(#"Grouped Rows", each [Sum] >= 0.2 or [Sum] <= -0.2)
in
    #"Filtered Rows"

 

 

I nortice that in your result you've got the Amount 58.56 for the ID 58, rather than the difference between the 2 amounts.

 

If you want to have this Amount from Table1, do a merge with my result table and Table1 to pull in the desired Amount, then delete unwanted columns.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
Mederic
Post Patron
Post Patron

Hello @PhilipTreacy ,

Thank you very much for this simple and effective solution,
I hadn't thought of it
Regarding your comment, the Amount column is not important, as long as we identify the ID references that are missing or out of date.
Your solution is very good

Have a nice day

Best regards

PhilipTreacy
Super User
Super User

HI @Mederic 

 

Download example PBIX file

 

After importing both tables you can Append them.

 

mergeamt.png

 

Then Group by ID and choose Sum as the aggregation.

 

grpa1.pnggrpa2.png

 

Then remove Amounts you don't want

 

filta1.pngfilta2.png

 

Here's the query for the merge onwards

 

 

let
    Source = Table.Combine({Table1, Table2}),
    #"Grouped Rows" = Table.Group(Source, {"ID"}, {{"Sum", each List.Sum([Amount]), type nullable number}}),
    #"Filtered Rows" = Table.SelectRows(#"Grouped Rows", each [Sum] >= 0.2 or [Sum] <= -0.2)
in
    #"Filtered Rows"

 

 

I nortice that in your result you've got the Amount 58.56 for the ID 58, rather than the difference between the 2 amounts.

 

If you want to have this Amount from Table1, do a merge with my result table and Table1 to pull in the desired Amount, then delete unwanted columns.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.