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 / Set logic to have star...
Power Apps
Answered

Set logic to have start date value before end date value

(0) ShareShare
ReportReport
Posted on by 15

Hi,

 

I'm creating a project submission Power App and I have two fields to select the start & end dates of the project.

 

Please let me know if there how I can set a logic for the start date to not accept any dates equal or greater than the end date.

 

Regards,

 

Vivek

Categories:
  • Verified answer
    nickellis74 Profile Picture
    432 Moderator on at

    Hi @vivekajith 

     

    So let's say there's two date controls: dtStart and dtEnd. Set both to have a blank default.

    On dtStart in the OnChange action:

    If(Self.SelectedDate > dtEnd.SelectedDate,Reset(dtStart);UpdateContext({showDateError: true}),UpdateContext({showDateError: false}))

    On dtEnd in the OnChange action:

    If(Self.SelectedDate < dtStart.SelectedDate,Reset(dtStart);UpdateContext({showDateError: true}),UpdateContext({showDateError: false}))

    Then have a label with text like "You cannot have a start date later than the end date", and set the 'Visible' property of that to

    showDateError

    Lastly, in the Submit button's DisplayMode property:

    If(showDateError,DisplayMode.Disabled,DisplayMode.Edit)

     

    That will have the effect of clearing any start date which is later than the end date, showing an error panel and preventing the user submitting until they've fixed it. 😀

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

    Hi @vivekajith ,

     

    You can use below formula to reset start date picker if selected date equals to or greater than end date.

    OnChange of start date picker.

    If(Self.SelectedDate>=EndDatePicker.SelectedDate,Reset(Self)&&Notify("Please select another date"))

     

    Best regards,

    Rimmon

  • nickellis74 Profile Picture
    432 Moderator on at

    @v-mengmli-msft 's solution is essentially the same idea, slightly more concisely executed. The only extra really in mine is disabling the submit button.

  • vivekajith Profile Picture
    15 on at

    Thank you @nickellis74 & @v-mengmli-msft for the quick responses. I'm all set!!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 360 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard