Thanks Hilfy,
I tried something vaguely similar, which seemed to work to a certain extent:
if {table.fieldX} <> 0
then 0
else previous ({table.fieldX})
Anyway, I'll try to describe the report for better understanding. The report contains financial bookings from incoming invoices. The amount of each incoming invoice is booked on one or more cost accounts. I am interested in one particular cost account (#4622), accumulated per supplier.
Group = booking
Details: invoice#, supplier#, financial account#, amount
The details per booking might look like the following examples (1600 is a standard financial account# for incoming invoices, total amount):
Booking 1:
70001, 12345, 1600, -$ 12.000
null, null, 4622, $ 10.000 (4622 is the cost account I am interested in)
null, null, 4635, $ 2.000
Booking 2:
70002, 23456, 1600, -$ 4.000
null, null, 4788, $ 1.000
null, null, 4850, $ 3.000
So, not all bookings will contain account# 4622, and if it does, it will not be the only account# the invoice amount is distributed to.
Now, if I want to have all the amounts booked on account# 4622 for each supplier, how can I do that?
I have done this so far:
- Selected: {table.account#} in ["4622", "1600"]
- Grouped on booking#
- Sorted on booking#, then on account#
- Used the above formula to get the supplier# in the detail row of account# 4622
- Made a crosstab to get the total amounts per supplier
The amounts are in the crosstab now, but I cannot use them as a subreport in a main report (evaluation time error). And I cannot sort the data on supplier# either, or else my formula won't work.
Any suggestions please? And, a small question besides: how can I select all booking# that contain account# 4622 AND account# 1600?
Thanks very much! Hope I've not made the issue more complicated instead of easier to understand. I apologise in advance.
Rick