- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Find element in another table based on DateTime range
Hi,
I struggle to link two element in two different table.
So I have two table ; "Planned route" and "Actual route".
I want to compare if all my planned rout are well executed.
For example;
for the planned route "0004264" planned at 00h20 on 6/10/2022
I need to check if I find a record in my actual table of "0004264" with "ActrouDateTime" between 5/10/2022 22h20 and 6/10/2022 02h20 (PlarouDateTime + and - 2 hours)
Thanks for your help,
Don
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @DonPepe
Thanks for reaching out to us.
you can try this measure
Measure =
var _start=MIN(StagPlannedData[PlarouDateTime])-2/24
var _end= MIN(StagPlannedData[PlarouDateTime])+2/24
var _count=CALCULATE(COUNTROWS(StagFullYearDLL),FILTER(ALL(StagFullYearDLL),StagFullYearDLL[ActrouDateTime]<=_end && StagFullYearDLL[ActrouDateTime]>=_start))
return IF(_count>=1,"Y","N")
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @DonPepe
Thanks for reaching out to us.
you can try this measure
Measure =
var _start=MIN(StagPlannedData[PlarouDateTime])-2/24
var _end= MIN(StagPlannedData[PlarouDateTime])+2/24
var _count=CALCULATE(COUNTROWS(StagFullYearDLL),FILTER(ALL(StagFullYearDLL),StagFullYearDLL[ActrouDateTime]<=_end && StagFullYearDLL[ActrouDateTime]>=_start))
return IF(_count>=1,"Y","N")
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @v-xiaotang ,
Thanks for your help !
Unfortunately I had the same results than my previous measure, so finaly I did multiple merges in Powerquery and now I have what I want.
Thanks again for your help,
Don
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi,
I already try with the measure below but I dont have the record if the actual route occure before midnight.
LinkPlannedActBis =
var _minDateTime = MAX(StagPlannedData[PlarouDateTime])-TIME(2,0,0)
var _maxDateTime = MAX(StagPlannedData[PlarouDateTime])+TIME(2,0,0)
return
IF(
MAX(StagPlannedData[PLAROU Code])=MAX(StagFullYearDLL[ACTROU Code])
&&
MAX(StagFullYearDLL[ActrouDateTime])>_minDateTime
&&
MAX(StagFullYearDLL[ActrouDateTime])<_maxDateTime,
"Y",
"N"
)
Fyi ; StagFullYearDLL = Actual table
Regards,
Don

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
Anonymous
| 11-12-2019 10:00 AM | ||
Anonymous
| 04-12-2023 07:53 AM | ||
02-27-2024 04:35 AM | |||
12-21-2023 12:24 PM | |||
04-10-2024 11:31 AM |
User | Count |
---|---|
83 | |
79 | |
53 | |
39 | |
37 |
User | Count |
---|---|
104 | |
85 | |
47 | |
43 | |
42 |