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 / Filter a Calendar Gall...
Power Apps
Unanswered

Filter a Calendar Gallery by date and time

(0) ShareShare
ReportReport
Posted on by 86

Hello, I would really appreciate some help with figuring this out.

I have a Calendar in a powerapp of staff leave.  The records are saved in a Sharepoint List and the columns Start Date and End Date are Date&Time Columns. 

It works perfectly fine filtering the records  that are between a start date and an end date into the correct days in the calendar, as long as the time is not changed (currently set to default time: 12:00 AM).  I need it to work to include the records that are between the start day & time and the end day & time as well.

For example this works ok:  Start Date: 01/01/2024 12:00 AM End Date: 01/01/2024 12:00 AM but this record does not show up

01/01/2024 09:00 AM End Date: 01/01/2024 05:00 PM and neither does this one 01/01/2024 09:00 AM End Date: 01/01/2024 11:00 AM.

 

This is the gallery filter:  

 

Filter(ColLeaveEvents, 'Start Date' <= DateTimeValue(Date_Real.Text) && 'End Date'>= DateTimeValue(Date_Real.Text) ).

See the attachments for more info

 

 

Categories:
I have the same question (0)
  • v-yueyun-msft Profile Picture
    on at

    Hi , @CateR 

    According to your code , do you mean you want to filter the current date data?

    Can you try to use this code in your side?


    Filter(ColLeaveEvents, 'Start Date' <= DateTimeValue(Date_Real.Text&" 23:59:59") && 'End Date'>= DateTimeValue(Date_Real.Text) )

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

  • CateR Profile Picture
    86 on at

    Hi @v-yueyun-msft I tried your code and the items in the gallery now have an error "the value xx cannot be converted to a a date or time value"- see attached.  To answer your question, I'm filtering by the date for the specific day of the calendar - Date_Real is the green date in the image - it is DateAdd(varFirstDayView, ThisItem.Value,TimeUnit.Days)

  • v-yueyun-msft Profile Picture
    on at

    Hi , @CateR 

    Thanks for your response! Can you try to use this code:
    Filter(ColLeaveEvents, 'Start Date' <= DateTimeValue( DateValue( Date_Real.Text) &" 23:59:59")

     && 'End Date'>= DateTimeValue(Date_Real.Text) )

     

    Best Regards,

    Yueyun Zhang

  • Verified answer
    CateR Profile Picture
    86 on at

    Hi Yueyun,  I didn't try your code - I got around the issue by removing time from the calendar and just working with days

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard