web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Identify overlapping o...
Power Apps
Answered

Identify overlapping of date range

(0) ShareShare
ReportReport
Posted on by

Hi Team,

 

We have a Leave management system where a user submits various leave plans for a month. When a user is selecting a date range for a leave plan , the date range should not be overlapping with the already selected date range.

 

Please let me know how to proceed on this.

 

Thanks in advance

 

Thanks,

Raj

Categories:
  • timl Profile Picture
    37,287 Super User 2026 Season 2 on at

    Hi @Raj301189 

    In essense, this structure will return true if the date ranges overlap.

    With(
     {
     startTime1:DateTimeValue("2022-01-05 10:00"),
     endTime1:DateTimeValue("2022-01-05 11:30"),
     startTime2:DateTimeValue("2022-01-05 09:30"),
     endTime2:DateTimeValue("2022-01-05 10:30")
     },
     startTime1 < endTime2 && startTime2 < endTime1
    )

    My post here describes this in more detail.

    http://powerappsguide.com/blog/post/detect-overlapping-times

     

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Raj301189 :

    I assume selected date is a list:

    ClearCollect(
     SelectedDate,
     {StartDate:DateTimeValue("2022-04-10 12AM"),EndDate:DateTimeValue("2022-04-11 12AM")},
     {StartDate:DateTimeValue("2022-04-11 12AM"),EndDate:DateTimeValue("2022-04-12 12AM")},
     {StartDate:DateTimeValue("2022-04-12 12AM"),EndDate:DateTimeValue("2022-04-13 12AM")}
     )

    and there are two date picker controls (DatePickerStart/DatePickerEnd)

    You could try this formula to get if the select dates are overlapping with the already selected date range:

    IsBlank(LookUp(
     SelectedDate,
     (DatePickerStart.SelectedDate<EndDate && DatePickerStart.SelectedDate>=StartDate) ||
     (DatePickerEnd.SelectedDate<=EndDate && DatePickerEnd.SelectedDate>StartDate) || 
     (DatePickerEnd.SelectedDate>=EndDate && DatePickerStart.SelectedDate<=StartDate)
    ))

    This formula will return true if the dates are not overlapping with the already selected date range.

    Best Regards,

    Bof

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard