Forum Discussion
Calculate Date Diff where reference matches
- 1 year ago
Hi JemmaD
please try below code
Date Difference =
VAR CurrentReference = [Reference]
VAR CurrentAmount = ABS([Amount])
VAR CurrentOpenDate = [Open Date]
VAR MatchingRow =
CALCULATE(
MIN('YourTableName'[Closed Date]),
FILTER(
'YourTableName',
'YourTableName'[Reference] = CurrentReference &&
ABS('YourTableName'[Amount]) = CurrentAmount &&
'YourTableName'[Open Date] = CurrentOpenDate
)
)
RETURN
IF(
NOT ISBLANK(MatchingRow),
DATEDIFF(CurrentOpenDate, MatchingRow, DAY),
BLANK()
)
Hi JemmaD
please try below code
Date Difference =
VAR CurrentReference = [Reference]
VAR CurrentAmount = ABS([Amount])
VAR CurrentOpenDate = [Open Date]
VAR MatchingRow =
CALCULATE(
MIN('YourTableName'[Closed Date]),
FILTER(
'YourTableName',
'YourTableName'[Reference] = CurrentReference &&
ABS('YourTableName'[Amount]) = CurrentAmount &&
'YourTableName'[Open Date] = CurrentOpenDate
)
)
RETURN
IF(
NOT ISBLANK(MatchingRow),
DATEDIFF(CurrentOpenDate, MatchingRow, DAY),
BLANK()
)
Thanks govind_021 this works! 🙂