Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
alya1
Helper V
Helper V

Check if there are dates within 60 days -> not same dates - at least 1 future date, across 2 tables

I have 2 tables like below:
table3

ID Date Type
111 1/1/2020 A 2020
111 1/1/2022 C 2022
111 10/10/2024 B 2024
… (many entries over the years)
222 2/2/2020 B 2020
2225/5/2024 A 2024
…(many entries over the years)
333 1/3/2025 B 2025
…(many entries over the years)

this table is for past dates

table1

ID Type A Type B Type C
111 1/1/2025  1/1/2025
222  2/2/2025 2/5/2025
333 2/3/2025  

this table is for in progress/future dates

How can I create a new column that returns yes or no which checks If matching ID have dates within 60 days of another (not same date) in both table1 and table2 AND at least 1 date is in the future?

For example, 111 should not be flagged.
222 should be flagged yes because there is a type B date and type C date are within 60 days in table1.
333 should be flagged yes because there is a 2/3/2025 date in table1 and a 1/3/2025 date in table3.
It doesn't matter what "type" the date is, as long as there is any dates within 60 days of each other across the 2 tables.
These 2 tables don't have relationship between each other, but are connected via a third table
table1 in 1:1 to table 2 by ID and table 2 to table 3 1:many.
(I know 1:1 relationships are unnecessary but it takes way too long to join the 2 tables in power query, open to other ideas!)
 

1 REPLY 1
amitchandak
Super User
Super User

@alya1 , Create these 2 column and try

 

Col1 =
Countx(filter(table3, table3[ID] = earlier(Table2[ID]) && table3[Date]-60 >= EARLIER(table3[Date]) && table3[Date]-60 >= EARLIER(table3[Date])), table3[ID])


Col2 = if( countx(filter(table3, table3[ID] = earlier(Table2[ID]) && [Col1] >=1), table3[ID]) >=1, 1, blank())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.