Attempting a new way to formulate my problem. I'm on it for a few weeks now...
I'm trying to achieve the following data structure in my script:
I want to calculate #Days Exhausted by Customer and Report Date. The logic to get to this number is already set up and it's correct: I'm recursively subtracting my Sales amount from my Debt amount, month by month (backwards) until the difference is negative. By each complete month I'm adding the days of that sales month. I'm doing this based on sorted tables and using the peek() function.
But I need to aggregate this calculation against all my Report dates, and right now I'm only able to set up the calculation against my most recent Report Date (which is 28/02/2021). I'm getting zeros in the red part of the screenshot.
What I'm saying is: I'm only getting the blue part of the picture above, and I need the red one as well (I have multiple report dates). How am I supposed to restart the #Days Exhausted calculation against all my Report Dates?