Well, my friend, I’ve got bad news and good news. The bad news is I could never figure out exactly what the cumulative total of the “sales going backwards in time” looked like, and how that fit into the overall picture. The good news is that I don’t think we need it at all since we can calculate the zero day directly without it using the following two branched measures:
DocDates AcctBal Nonzero =
[AccountBal] > 0,
SELECTEDVALUE( FullFile[DocumentDate] ),
VALUES( FullFile[DocumentDate] ),
[DocDates AcctBal Nonzero]
REMOVEFILTERS( FullFile[DocumentDate] )
Once we have the zero day, calculating the DSO is just a no-frills DATEDIFF measure:
Here are the two test cases you provided in your last explanation to show that the calculations are working properly:
I’ve enjoyed working with you on this and I hope this gets you what you need.
Full solution file attached below.
eDNA Forum DebtorsEDNA Solution2d.pbix (511.4 KB)