• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Balance Data by Comparing two table

Chirag Chheda

New Member
Unable to fetch balance data by comparing two tables with unique detail

Table A
A1014200
A1518100
A1014300
A1014100

Table B
A1014700
A1518100
A1518300

Require Output (B-A)
A1014100
A1518300
 
Using Power Query, you can merge the two files. Here is the Mcode for that. You will need to upload each table to PQ and then close and load to a connection only.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", Int64.Type}, {"Column3", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each [Column3] * -1),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column3"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom", "Column3"}}),
    #"Appended Query" = Table.Combine({#"Renamed Columns", Table2}),
    #"Grouped Rows" = Table.Group(#"Appended Query", {"Column2"}, {{"Total", each List.Sum([Column3]), type number}})
in
    #"Grouped Rows"

File is attached for your analysis
 

Attachments

  • Book17.xlsm
    27.5 KB · Views: 0
Back
Top