Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 |
222 | 5/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!)
@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())
User | Count |
---|---|
73 | |
70 | |
38 | |
24 | |
23 |
User | Count |
---|---|
96 | |
93 | |
50 | |
41 | |
40 |