I'm running a report off of a single view. The view contains invoices with an invoice id, and a charge amount but also contains payments with payment id's. So the data may look like
Inv Chg PmtID PmtAmt
1 1000 A 150
1 1000 B 45
1 1000 C 250
2 2000 D 600
2 2000 E 700
3 3000
etc
If I were doing a simple sum of the chg column I would end up 3000 for inv 1 and 4000 for inv 2 when, in fact, the totals are 1000 for inv 1 and 2000 for inv 2.
I've tried to do things such as combining running count and if/then (ex// if @RunningCt = 1 then Chg else 0). The if/then works as it should, but I can't sum on this new figure.
Any ideas???
Inv Chg PmtID PmtAmt
1 1000 A 150
1 1000 B 45
1 1000 C 250
2 2000 D 600
2 2000 E 700
3 3000
etc
If I were doing a simple sum of the chg column I would end up 3000 for inv 1 and 4000 for inv 2 when, in fact, the totals are 1000 for inv 1 and 2000 for inv 2.
I've tried to do things such as combining running count and if/then (ex// if @RunningCt = 1 then Chg else 0). The if/then works as it should, but I can't sum on this new figure.
Any ideas???