У меня есть таблица расходов для каждой даты, как показано ниже
For each payment date as below, I need to calculate the expected amount and expected total amount based on the charges from the first table. For 02/10/2019, it is 1+2+3=6 (the charges after July until October). For 09/10/19 it should be the same as above as it's still October. For 08/01/20, 4+5+6=15. Can someone please help on how to achieve this. Thank you.
введите описание изображения здесь