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 / Finding nearest date i...
Power Apps
Unanswered

Finding nearest date in one SharePoint List based on user input

(0) ShareShare
ReportReport
Posted on by 17

Hi All!

 

I have 2 SharePoint lists, the first one is a static lookup list that contains a column called "Submission Date" which are unique dates throughout the year.

 

The second list is where I want to capture user input. On this list I have:

  • A choice filed called "Classification"
  • A date field called "Planned Submit Date" that can accept any date

I want to create an App where if the "Classification" equals "Submit" then I can perform a lookup that finds the next date (greater than or equal to) the "Planned Submit Date" in the "Submission Date" column on the first list.

 

Can anyone help?

Categories:
  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @Juliet ,

     

    You require help in the query building ? 

  • rubin_boer Profile Picture
    4,843 Super User 2024 Season 1 on at

    hi @Juliet it look you have two conditions

    1. evaluate the choice column

    2. check the selected date and get first available static date

     

    as your title is find date I will give a solution to number 2, if you need assistance with number let me know

     

    you will need the static dates in a collection, a datepicker and a label to show the first available date

     

    Collect the static dates, lest call it colSdates, in the example i added a few dates for illustration below

    ClearCollect(colSdates,["01 August 2021", "22 August 2021", "15 November 2021"])

    and then i added it to a gallery

    rubin_boer_0-1628961336198.png

    Now lets add the datepicker which in you rcase will be the "Planned submit date", lets call it dtPlannedDate. add a label to illustrate the first available date lblSubmitDate

     Set the label.text to

    First(
     Filter(colSdates,
     DateDiff(DateValue(Value,"en-US"), dtPlannedDate.SelectedDate)<=0
     )
     ).Value

     

    the solution will be as follows:

    when the use selects the 1 Aug as planned submit date the response will be

    rubin_boer_1-1628961563516.png

     

    now lets select 2 aug and we expect the response to be the 22 aug  right

    rubin_boer_2-1628961615380.png

    Lets do the 15th and 16th nov

    rubin_boer_3-1628961650798.png

    16th epty as no static dates are defined

     

    rubin_boer_4-1628961668818.png

     

    hope this helps

     

     

     

     

     

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 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard