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

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

 

 

Date_Real.png
OnVisible.png
Gallery filter.png
Categories:
  • v-yueyun-msft Profile Picture
    Microsoft Employee 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)

    error.png
  • v-yueyun-msft Profile Picture
    Microsoft Employee 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

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

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard