Customer Statement Balance - Reversal Payments

Hi

Hoping someone can help me. I am struggling with the balance on customer statements when there is applied credit.

If there is a payment and reversal payment I can solve this by “= sum(Fields!charge.Value) + sum(Fields!docDtlTranAmount.Value) + ((sum(CDec(Fields!CMemo.Value)) + sum(Cdec(Fields!docDtlTranAmountSignAdjusted.Value))) * -1)”

When there is applied credit this is duplicating my records and I am struggling on the calculation.

I do want to show payments but only if there is an outstanding amount but I have included a where clause where DocInvoiceBal <>‘0’

I am joining InvcHed to Cashdtl by invoicenum.

Any help would be much appreciated.

Regards
Kirsty

have resolved issue by creating a subquery