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 / Picking up the correct...
Power Apps
Unanswered

Picking up the correct date from Sharepoint List onto Power Apps

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello! I need some assistance on my formula so that the correct date can be picked up from my Sharepoint List onto Power Apps.

 

Here’s my context: I am trying to create an app for ticket reservations, and each person can only reserve the ticket once every 2 months. Eg: If I reserve the ticket today (17/09), I can reserve a ticket that is dated 2 months from today (17/11 onwards). My formula on Power Apps would check through 2 columns from my Sharepoint List: Status (= Reserved) and Date of Visit.

Here’s my problem:  My current formula can’t fulfil the condition to book once every 2 months. For eg: I first make a booking for 1 Jan 2022 and make a second booking for 1 Oct 2021. If I make a third booking for 31 Dec 2021, instead of stopping this reservation from happening since my next booking is on 1 Jan 2022, my formula would allow this reservation to be submitted instead because it is more than 2 months from 1 Oct 2021.

 

How should I go about refining my formula? Here's my formula:

If(And((LookUp(Sort(SharepointList,DateofVisit,Descending), ID=DataCardValue16.Text,Status="Reserved") And (LookUp(Sort(SharepointList,DateofVisit,Descending), ID=DataCardValue16.Text,DateofVisit)-DataCardValue22.SelectedDate)<=60),((LookUp(Sort(SharepointList,DateofVisit,Descending), ID=DataCardValue16.Text,Status)="Reserved") And (DataCardValue22.SelectedDate-(LookUp(Sort(SharepointList,DateofVisit,Descending), ID=DataCardValue16.Text,DateofVisit))<=60))),"You can only make a booking once in every 2 months.",""))

 

Have tried multiple ways but am still stuck at it. Appreciate your help, thank you!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,100 Most Valuable Professional on at

    Hi @Anonymous ,

    You might try something like this - although I am wondering how the ID which is numeric is equal to the value in DataCard16.Text

    With(
     {
     wList:
     Filter(
     SharepointList,
     ID=DataCardValue16.Text &&
     Status="Reserved"
     ),
     wDate:DataCardValue22.SelectedDate,
     wDate1:DataCardValue22.SelectedDate - 60,
     wDate2:DataCardValue22.SelectedDate + 60 
     },
     If(
     !IsBlank(
     LookUp(
     wList:
     DateofVisit =< wDate &&
     DateofVisit > wDate1
     ).DateofVisit
     ) ||
     !IsBlank(
     LookUp(
     wList:
     DateofVisit >= wDate &&
     DateofVisit < wDate2
     ).DateofVisit
     ),
     "You can only make a booking once in every 2 months.",
     ""
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The ID here is actually the Pass ID (alpha-numeric) that the individual will input, hence it is a text instead. I tried the formula, but it doesn't work.. I dont really get the LookUp formula, and I have no idea how to go about using With formula. Is there a way that I can use a For All formula? 

     

    Also, I am aware that using Sort is the main reason that is causing my formula to fail, but I'm not sure how should I go about checking all dates on the sharepoint list..

  • WarrenBelz Profile Picture
    156,100 Most Valuable Professional on at

    @Anonymous ,

    I simply answered your posted query Picking up the correct date from Sharepoint List onto Power Apps

    "does not work" unfortunately will not let me assist you - is there an error (if so what) or does it not produce the desired result. ForAll() is not something relevant here.

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 96 Super User 2026 Season 1

Last 30 days Overall leaderboard