@Pete673,

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 =
IF(
[AccountBal] > 0,
SELECTEDVALUE( FullFile[DocumentDate] ),
BLANK()
)
ZeroDay =
CALCULATE(
MINX(
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:

```
DSO =
DATEDIFF(
[ZeroDay],
[SelectedDate],
DAY
)
```

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.

– Brian

eDNA Forum DebtorsEDNA Solution2d.pbix (511.4 KB)