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 / Problem with filtering...
Power Apps
Unanswered

Problem with filtering Items in gallery

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, i have a problem with gallery filter. Now i'm trying to do it with excel, but it doesnt't work if i use sharepoint too. So i have two tables in Excel, first is called Floor1, where data about desks is stored with column Title (Desk 1, Desk 2 etc), and Reservation1, where data about reservations is stored with colums Title (John Doe Desk 1), DeskText (Desk 1, Desk 2, etc), CheckOutFrom (start date) and CheckOutTo (end date). Reservations write to Reservation1 successfully, but filter in my gallery doesn't work correctly. The formula I am using right now for gallery items is: 

Filter(tbFloor1,Not(Title in Filter(tbReservation1,CheckOutFrom >= startTime && CheckOutTo <= endTime || CheckOutFrom <= endTime && CheckOutTo >= endTime).DeskText))

startTime and endTime are variables set on OnSelect property of Continue button after selecting dates in calendar component. In calendar component there is selected Range option. 

Set(selectedDate,Calendar_1.StartDate);
Set(selectedDateEnd,Calendar_1.EndDate);
Set(startTime,DateValue(Text(selectedDate,DateTimeFormat.ShortDate)));
Set(endTime,DateValue(Text(selectedDateEnd,DateTimeFormat.ShortDate)))

 

What is working: when i select one date and reserve it, it doesn't appear in gallery, BUT

1) if i reserve, for example, Desk1 on 1st May, this desk won't show on 1st of May, but also on any date before and after 1st of May, even tho it is free (here i think problem is that when you click once on date on calendar, only CheckOutFrom is written (1/5/2021) and CheckOutTo remains blank. But if i click twice on date, then both CheckOutForm & CheckOutTo are 1/5/2021 and i am able to reserve this desk on other dates. So maybe the question is, is there a way to say to the powerapp, that if only startTime is selcted, then they should be equal with endTime, so it could understand that it is reserved for one day only?

2) If i reserve a range, for example, 3-5 May, even tho the dates will be correctly written in CheckOutFrom 3/5/2021 and CheckOutTo 5/5/2021, i will be able to reserve all these dates, 3,4,5th of May.

 

It is very important for my app, if someone has the answer, please, i will be very grateful! 

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    You need to provide parenthesis around sections of your filter to establish the proper logic and order of precedence. 

    Please consider changing your Formula to the following:

    Filter(tbFloor1,
     !(Title in 
     Filter(tbReservation1, 
     (CheckOutFrom >= startTime && CheckOutTo <= endTime) || 
     (CheckOutFrom <= endTime && CheckOutTo >= endTime)
     ).DeskText
     )
    )

     

    I hope this is helpful for you.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you, but this doesn't work. I can select same desk after date, but still cannot select the same desk before date and range still doesn't work 😞

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    So without scrubbing that formula, in general it is correct.

    But you say that values are not getting written to the data for the start or end dates?

    So let's focus on statement #1 from your original post.  How are you storing data into tbReservation1 ?

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

#2
WarrenBelz Profile Picture

WarrenBelz 204 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard