I'm trying to create the far right column correctly below (Desired Variable D). I have everything to the left of us. The Variable C is the # of days between a given row and the row previous. Variable D that I have created is the same except variable B tells me if something happened (a 1) or not (a 0). If something did not happen (as nothing happened on 6/11/2019), then I want Desired Variable D to be the number of days between a row where it's 1 on Variable B and then the previous row where Variable B is also 1. So while something was sent on 6/11/2019, nothing happened. So since something happened again on 6/18, the number of days between when a previous thing happened on 6/4 and 6/18 is 14.
| Variable A | Variable B | Variable C | Variable D | Desired Variable D |
| 5/21/2019 | 1 | 7 | 7 | 7 |
| 5/28/2019 | 1 | 7 | 7 | 7 |
| 6/4/2019 | 1 | 7 | 7 | 7 |
| 6/11/2019 | 0 | 7 | [Null] | [Null] |
| 6/18/2019 | 1 | 7 | 7 | 14 |
| 6/25/2019 | 1 | 7 | 7 | 7 |