Selecting specific rows where credit/debit balance does not equal zero

in general you can do it by grouping the data on SKU Or Item ID

When processing the group members we would suggest to check some more requirements e.g. handling when not the exact opposite amount is to handle (when this can happen) like
5,-5,3,-2 → we assume 3,-2
5,-3,-2 → we assume no tows to keep

some you can implement some more specifics e.g finind pairs by mathing the closest opposite amount, or taking oldest first…