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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Validating selected da...
Power Apps
Answered

Validating selected date on power apps with sharepoint list

(0) ShareShare
ReportReport
Posted on by

Hello! I need some help with validating selected date on power apps with my sharepoint list.

 

Context: I am trying to create an app that can issue max. 2 tickets a day. So, when an individual selects a date on the power app, this formula will look through 2 columns on my sharepoint list, mainly 'Date column' and 'tickets column' (text formatted) to see if there are still tickets available on the day. If both tickets are taken on that day, I have a text label below the date to indicate that the date is unavailable. See text in red in screenshot.

j_y_0-1631186836430.png

 

My question is, how should I go about creating the formula? My current formula below doesn’t work:

If(DataCardValue22.SelectedDate) = Filter(SharepointList,DateofVisit=DataCardValue22.SelectedDate And Status = "Reserved"),"Date is unavailable.","")

 

Thanks!

Categories:
I have the same question (0)
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    We will use a count rows. If 

    If(CountRows(Filter(SPLIST, ,DateofVisit=DataCardValue22.SelectedDate, Status = "WE HAVE TICKETS")) <= 0, "Date is unavailable","")

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

     

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

    Hi @Anonymous ,

     

    May be something like below will work in your case ? 

    If(CountRows(Filter(SharepointList,DateofVisit=DataCardValue22.SelectedDate And Status = "Reserved").ID)>=2,"Date is unavailable.","")

     

    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.

  • Verified answer
    JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    It looks like you have an extra quotation mark at the end of your formula.   Also you can just have ""   to indicate no text.  It's not necessary to put a character like a comma in there.

     

    If removing the comma doesn't work, you might want to check and make sure it's comparing the dates property.  You can do that by dropping a label and datepicker on your screen with this formula: to see if it returns a number.  Use the date picker to select a date that you know is in the list.

     

    CountRows(
    Filter(SharePointList, DateofVisit = DatePicker.Selected.Date && Status = "Reserved"))

     

    If that works, then try this

    If(
     CountRows(
     Filter(SharePointList, DateofVisit = DataCardValue22.SelectedDate && Status = "Reserved")) = 2,
     "Date is unavailable". ""
    )

     

     

  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @Anonymous,

    Have you solved your problem?

    Do you want to check if there are 2 tickets reserved for the same selected date?

    Could you please tell me more about your scenario?

    There is something syntax wrong with your formula, DataCardValue22.SelectedDate is a type of date value, but the Filter result is a type of table. Beside, if you want to compare the date with the Filter result, you should call the DateofVisit column from the Filter() result.

    In a word, other users replied with different methods which are completely correct.

    Just check for only one tip, if your Status is a Choice column, please refer to it using "Status.Value".

    If(CountRows(Filter(SharepointList,DateofVisit=DataCardValue22.SelectedDate And Status.Value = "Reserved"))>=2,"Date is unavailable.","")

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard