Forum Discussion
Anonymous
6 years agoNot applicable
Check if date falls between two dates
Hi All Hoping someone can help I have a table which contains various data items for clients including a 'last contacted date'. I need to be able to identify whether the 'last contacted date'...
Anonymous
6 years agoNot applicable
Here is some sample data
ID | DateofLatestVisit | LatestContact | LatestContactDate | Contacted In Period |
| 34856 | 12/05/2020 | 12/05/2020 | Not contacted | |
| 38197 | 11/03/2020 | 11/03/2020 | Not contacted | |
| 38198 | 04/06/2020 | 04/06/2020 | Last Two Weeks | |
| 38199 | 04/06/2020 | 04/06/2020 | Last Two Weeks | |
| 57067 | 29/04/2020 | 29/04/2020 | Not contacted | |
| 59186 | 22/04/2020 | 04/06/2020 | 04/06/2020 | Last Two Weeks |
| 61948 | 22/05/2020 | 22/05/2020 | Last Four Weeks | |
| 61949 | 27/03/2020 | 27/03/2020 | Not contacted | |
| 62027 | 11/05/2020 | 22/05/2020 | 22/05/2020 | Last Four Weeks |
| 71477 | 21/05/2020 | 21/05/2020 | Last Four Weeks | |
| 73906 | 06/05/2020 | 22/05/2020 | 22/05/2020 | Last Four Weeks |
| 88968 | 03/06/2020 | 03/06/2020 | 03/06/2020 | Last Two Weeks |
| 101607 | 07/05/2020 | 07/05/2020 | Not contacted | |
| 113904 | 11/05/2020 | 11/05/2020 | Not contacted | |
| 121868 | 30/04/2020 | 02/06/2020 | 02/06/2020 | Last Two Weeks |
| 127578 | 12/05/2020 | 12/05/2020 | Not contacted | |
| 127580 | 12/05/2020 | 12/05/2020 | Not contacted | |
| 129058 | 05/05/2020 | 05/05/2020 | Not contacted | |
| 133488 | 20/04/2020 | 29/05/2020 | 29/05/2020 | Last Four Weeks |
| 134951 | 13/05/2020 | 05/06/2020 | 05/06/2020 | Last Two Weeks |
| 135583 | 03/06/2020 | 22/05/2020 | 03/06/2020 | Last Two Weeks |
| 137372 | 18/05/2020 | 18/05/2020 | 18/05/2020 | Last Four Weeks |
| 137778 | 15/05/2020 | 28/05/2020 | 28/05/2020 | Last Four Weeks |
| 137883 | 08/06/2020 | 03/06/2020 | 08/06/2020 | Last Two Weeks |
| 138856 | 15/05/2020 | 05/06/2020 | 05/06/2020 | Last Two Weeks |
| 138858 | 28/05/2020 | 28/05/2020 | Last Four Weeks | |
| 139633 | 08/06/2020 | 05/06/2020 | 08/06/2020 | Last Two Weeks |
| 146402 | 27/05/2020 | 27/05/2020 | Last Four Weeks | |
| 147456 | 13/05/2020 | 01/06/2020 | 01/06/2020 | Last Two Weeks |
| 149252 | 14/05/2020 | 05/06/2020 | 05/06/2020 | Last Two Weeks |
| 150232 | 16/04/2020 | 29/05/2020 | 29/05/2020 | Last Four Weeks |
| 154454 | 03/06/2020 | 22/05/2020 | 03/06/2020 | Last Two Weeks |
| 155148 | 15/05/2020 | 29/05/2020 | 29/05/2020 | Last Four Weeks |
| 155167 | 28/05/2020 | 28/05/2020 | 28/05/2020 | Last Four Weeks |
| 156052 | 14/05/2020 | 14/05/2020 | Not contacted | |
| 156260 | 20/05/2020 | 04/06/2020 | 04/06/2020 | Last Two Weeks |
| 156944 | 13/05/2020 | 05/06/2020 | 05/06/2020 | Last Two Weeks |
edhans
6 years agoCommunity Champion
This seems to work.
Within Two Weeks =
VAR VendorDate =
MAX( 'Table'[LatestContact] )
VAR SelectedDates =
ALLSELECTED( 'Date'[Date] )
VAR SelectedDate = [Selected Dates]
VAR DayCount = 14
VAR DateRange =
DATESBETWEEN(
'Date'[Date],
SelectedDate - DayCount,
SelectedDate
)
VAR WithinDateRange = VendorDate
IN DateRange
VAR Result =
IF(
HASONEVALUE( 'Date'[Date] ),
WithinDateRange,
"Multiple Selections"
)
RETURN
Result
See below. You'll note the date I selected is June 1, so future dates are all showing false. You just need to replace the final logic of true/false with whatever you want to show.