Subtract one list of numbers from another list of numbers?

I have an invoice with x number of payment transactions. Each transaction updates the invoice with a payment date and a remaining amount of the invoice which remains to be paid.

Now, I want to go back in time and get the answer for a random date like :
“what was the remaining amount on yyyy-mm-dd?”

Bubble, in backend wf, shows me a List Filter dialog without the “Advanced…” option. Instead I only get to write a Constraint related to the field type I am currently working on (the accurate nth item of the remaining amount cannot be filtered based on the date).

Can I create a list of 2 fiels [{date, remaining amount}, {date, remaining amount} ] and then extract the 2nd value using a filter criteria on the date?

Why not just make Transaction a data type?. An invoice contains a list of Transactions. Each line item has a date, description, quantity, and amount. This will make your life 10x easier. Just get Invoice’s Transactions:filtered: date < X to get the relevant line items.

Thanks. I do have the Transaction as a data type and still I can’t figure out how to do it. But maybe I shall try once again by looking at the Customer Payments data type . Thx for pointing this out.

I don’t really understand why you even need a filter

Can’t you just do the below?
Search for transactions: transaction date<= Date picker’s date: last item’s remaining amount

1 Like

Thanks for the attention.
What I want to do in the end is to print each invoice’s not paid amount.
can I take a list of numbers (10, 20, 15) and subtract that list with another list of numbers (5, 20, 12) so that the result becomes (5, 0, 3)?

The number of Customer Payments per invoice can vary so first I need to sum the Customer Payments up, one sum for each Invoice.