Calculate Running Total per Invoice in a VI Job

My client imports SO Invoices, and would like to calculate the quantity of one line based on the running total of the other lines, and then assign that quantity to the item line.  Here's the scenario:

1. Accumulate the quantity of all the items that start with "L".  I am doing this with a Line level Temp field (Temp1 + {SO_InvoiceDetail.QuantityOrdered} with a condition to calculate only on items that qualify)

2. Assign that quantity to the item line designated for the total.  I am doing that with a calculated field assigning the new Temp1 value if the item qualifies.

This works great, if there is only one invoice!

My problem is that I can't get Temp1 to clear or reset between invoices.  The Clear on Each Record box doesn't seem to affect the outcome at all.  I tried adding another variable to store the prior amounts and subtract them, but either it can't be done, or I am just not approaching it correctly. 

The end result should be, where Item Z is the total of the other lines on the invoice:

Inv#1 Item A Qty 10, Item B Qty 20, Item Z Qty 30 

Inv#2 Item A Qty 50, Item Z Qty 50

But I get:

Inv#1 Item A Qty 10, Item B Qty 20, Item Z Qty 30 

Inv#2 Item A Qty 50, Item Z Qty 80

Does anyone have a suggestion, or has tried this successfully?  Or knows for sure that this will never work and I have to resort to a script for them?  Thanks!