Forum Discussion
If Statement Comparing Dates Between Tables
- 4 years ago
Hi Dawson16 ,
According to your description, here's my solution.
The two tables are related with the ID# column. Then create two calculated columns in the Work Orders table.
Start Date in Project Range? = IF ( 'Work Orders'[Start Date] >= RELATED ( 'Projects'[Start Date] ) && 'Work Orders'[Start Date] <= RELATED ( Projects[Finish Date] ), "In Range", "Out of Range" )Finish Date in Project Range? = IF ( 'Work Orders'[Finish Date] >= RELATED ( 'Projects'[Start Date] ) && 'Work Orders'[Finish Date] <= RELATED ( Projects[Finish Date] ), "In Range", "Out of Range" )Create two calculated columns in the Projects table.
ALL WO Start Dates in Range? = IF ( COUNTROWS ( FILTER ( 'Work Orders', 'Work Orders'[ID #] = EARLIER ( 'Projects'[ID #] ) && 'Work Orders'[Start Date in Project Range?] = "Out of Range" ) ) > 0, "No", "Yes" )ALL WO Finish Dates in Range? = IF ( COUNTROWS ( FILTER ( 'Work Orders', 'Work Orders'[ID #] = EARLIER ( 'Projects'[ID #] ) && 'Work Orders'[Finish Date in Project Range?] = "Out of Range" ) ) > 0, "No", "Yes" )Get the correct result.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Dawson16 ,
According to your description, here's my solution.
The two tables are related with the ID# column. Then create two calculated columns in the Work Orders table.
Start Date in Project Range? =
IF (
'Work Orders'[Start Date] >= RELATED ( 'Projects'[Start Date] )
&& 'Work Orders'[Start Date] <= RELATED ( Projects[Finish Date] ),
"In Range",
"Out of Range"
)
Finish Date in Project Range? =
IF (
'Work Orders'[Finish Date] >= RELATED ( 'Projects'[Start Date] )
&& 'Work Orders'[Finish Date] <= RELATED ( Projects[Finish Date] ),
"In Range",
"Out of Range"
)
Create two calculated columns in the Projects table.
ALL WO Start Dates in Range? =
IF (
COUNTROWS (
FILTER (
'Work Orders',
'Work Orders'[ID #] = EARLIER ( 'Projects'[ID #] )
&& 'Work Orders'[Start Date in Project Range?] = "Out of Range"
)
) > 0,
"No",
"Yes"
)
ALL WO Finish Dates in Range? =
IF (
COUNTROWS (
FILTER (
'Work Orders',
'Work Orders'[ID #] = EARLIER ( 'Projects'[ID #] )
&& 'Work Orders'[Finish Date in Project Range?] = "Out of Range"
)
) > 0,
"No",
"Yes"
)
Get the correct result.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Dawson164 years agoFrequent Visitor
This is exactly what I was looking for and should work great. Thank you so much for taking the time to answer this!