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 / Date and Time in-between
Power Apps
Answered

Date and Time in-between

(1) ShareShare
ReportReport
Posted on by 56

Hi Team,

 

I am trying to filter data from my table from based on selected start date time and end date time I am using below query which is not working as required please help me on this .

 

Filter(
Not(
Seat_x0020_Number in Filter(
'Desk Reservations',
DateTimeValue(CheckOutFromText) >= startTime && DateTimeValue(CheckOutToText) <= endTime || DateTimeValue(CheckOutFromText) <= endTime && DateTimeValue(CheckOutToText) >= endTime
).DeskText)

)

Categories:
  • WarrenBelz Profile Picture
    156,545 Most Valuable Professional on at

    Hi @raassd ,

    You are missing the list name and also had end time in there three times. As well, some bracketing is needed between And/Or

    Filter(
     YourListNameHere,
     !(
     Seat_x0020_Number in 
     Filter(
     'Desk Reservations',
     (
     DateTimeValue(CheckOutFromText) >= startTime && 
     DateTimeValue(CheckOutToText) <= endTime
     ) || 
     (
     DateTimeValue(CheckOutFromText) <= startTime && 
     DateTimeValue(CheckOutToText) >= endTime
     )		 
     ).DeskText
     )
    )

     

    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.

    Visit my blog Practical Power Apps

     

  • raassd Profile Picture
    56 on at

    @WarrenBelz ,

    Thanks for your reply !

    I have used the above code but still I am not getting my required output.

    User 1 had booked a set from 10/06/2022 12.00 PM to 10/06/2022 6.00 PM Desk1

    User 2 is trying to book from 10/06/2022 1.00 PM to 10/06/2022 7.00 PM as per the logic desk 1 should not be visible but here in the above code desk 1 is visible.

     

    raassd_0-1654852851250.png

    raassd_1-1654852925323.png

     

    raassd_3-1654852950293.png

     

     

    Thanks in Advance !

     

     

     

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

    @raassd ,

    I was simply fixing the syntax of what you posted. The logic is looking for records in 'Desk Reservations' where the 'Seat Number' in your main list does not appear in 'Desk Reservations' in the DeskText field when either the checkout to or checkout from are between the start and end time of the record (which appears to be what you need)

    You are also using DateTimeValue on a Text field, so maybe you need to do some debugging on the outputs of your controls.

  • raassd Profile Picture
    56 on at

    @WarrenBelz ,

    Thanks for your reply !

     

    Please help me on this, I have spent more time but no use.

     

    Below is my patch code.

     

    raassd_0-1654855209290.png

    Thanks in Advance !

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

    @raassd ,

    That is a different topic to your post, but what exactly is wrong with it and why are you using TimeZoneOffset? Also can you please post your code in Text.

  • raassd Profile Picture
    56 on at

    @WarrenBelz 

     

    Here is my code 

     

    ForAll(
    SelectedDesk,
    Patch(
    'Desk Reservations',
    Defaults('Desk Reservations'),
    {
    Title: currentUser.FullName & " " & ThisRecord.Title,
    DeskText: ThisRecord.Seat_x0020_Number,
    CheckOutFrom: DateAdd(
    startTime,
    TimeZoneOffset(),
    Minutes
    ),
    CheckOutFromText: startTime,
    CheckOutFromNumber: Value(
    Text(
    startTime,
    "yyyymmddhhmm"
    )
    ),
    CheckOutTo: DateAdd(
    endTime,
    TimeZoneOffset(),
    Minutes
    ),
    CheckOutToText: endTime,
    CheckOutToNumber: Value(
    Text(
    endTime,
    "yyyymmddhhmm"
    )
    ),
    'Reserved By': currentUser.FullName
    }
    )
    );

     

     

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

    @raassd ,

    Yes, but what is wrong with it ?

  • raassd Profile Picture
    56 on at

    @WarrenBelz ,

    I am trying to filter by desks numbers if the user has already booked desk that desk number should be visible in the selected time frame for the next user so please help me on fixing the filter code.

    Filter(
    Desks,GOL = GOLData,Not(
    Seat_x0020_Number in Filter(
    'Desk Reservations',
    DateTimeValue(CheckOutFromText) >= startTime && DateTimeValue(CheckOutToText) <= endTime || DateTimeValue(CheckOutFromText) <= endTime && DateTimeValue(CheckOutToText) >= endTime
    ).DeskText)

    )

     

    I am using above code .

     

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

    @raassd ,

     I meant your Patch code - I have already responded to the filter - you need to check your data outputs first as the code is valid.

     

  • raassd Profile Picture
    56 on at

    @WarrenBelz ,

     

    Filter is not working as expected, as you said check my output data so I showed you my pact code.

    If anything needs to changed in my patch code please suggest me .

     

    Thanks !

     

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