Forum Discussion

Mederic's avatar
Mederic
Post Patron
2 years ago
Solved

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 ...
  • PhilipTreacy's avatar
    2 years ago

    HI Mederic 

     

    Download example PBIX file

     

    After importing both tables you can Append them.

     

     

    Then Group by ID and choose Sum as the aggregation.

     

     

    Then remove Amounts you don't want

     

     

    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