You want another field in your invoice lines table that is a stored calculation of "discounted price" (IE invoicelines::discountedPrice).
The calculation would look something like this:
if (products::discounted = "YES", price ; "0" )
this would return zero for regular items, and the price if the indicator says "yes, this product is discounted". You could then summarize this calculation field on your invoice with another field (IE invoices::discountSum) that stores:
Perfect hint. Easy if you know it but I did not... Thanks!