Hello!
I need to add the last balance of each invoice and product in a range of dates.
I have a table with invoice date and payment date. Only invoices that meet the date range and payments that meet the date range should be considered.
In the image I show a little better the result I need to obtain.
I tried with this expression but it didn't work for me.
SUM(AGGR(FirstSortedValue({<
InvoiceDate={">=$(=Date(vMinDate)) <=$(=Date(vMaxDate))"},
PaymentDate={">=$(=Date(vMinDate)) <=$(=Date(vMaxDate))"}>}
CurrentBalance, -PaymentDate)
, InvoiceID + ProductID)
)
Greetings, thanks for your help.