Hello,
I am getting the below using the following variables:
[bDates] = [Date] Where([Transaction]="B")
[daysDiff] = DaysBetween([bDates];[Date])
Result =Min([daysDiff]) Where ([daysDiff] >= 0) In ([ID])
ID | Transaction | Date | Desired Result | bDates | daysDiff | result |
---|---|---|---|---|---|---|
1 | A | 01/01/2015 | 07/01/2015 | 0 | ||
1 | B | 05/01/2015 | 07/01/2015 | 05/01/2015 | 0 | 0 |
1 | B | 07/01/2015 | 07/01/2015 | 07/01/2015 | 0 | 0 |
2 | A | 01/01/2015 | 02/01/2015 | 0 | ||
2 | B | 02/01/2015 | 02/01/2015 | 02/01/2015 | 0 | 0 |
2 | A | 05/01/2015 | -- | 0 |