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 / Delegation Issues When...
Power Apps
Answered

Delegation Issues When Filtering SharePoint Calendar Events by Date

(0) ShareShare
ReportReport
Posted on by 29

Hi Power Apps Community,

I am working on a Power Apps application that interacts with a SharePoint calendar list. I am facing challenges with delegation warnings when trying to filter events by a specific date. Here’s what I’m trying to achieve, what I’ve tried so far, and the errors or issues I’ve encountered. Any assistance or guidance would be greatly appreciated!

Objective:
- Display only today's events in a gallery.
- Allow navigation between dates using previous and next buttons.

 

What I’ve Tried:

1. Initialize the Date Variable in `OnStart`:

Set(selectedDate, Today());
```

2. Filter the Gallery's Items Property:

I tried several approaches:

- Using a simple date comparison:
Filter(
CalendarEvents,
EventDate >= selectedDate && EventDate < DateAdd(selectedDate, 1, Days)
)

Result: Delegation warning encountered.

- Using `Year`, `Month`, and `Day` functions:
Filter(
CalendarEvents,
Year(EventDate) = Year(selectedDate) &&
Month(EventDate) = Month(selectedDate) &&
Day(EventDate) = Day(selectedDate)
)

Result: Delegation warning encountered.

- Using `LookUp` and `IsBlank`:

Filter(
CalendarEvents,
!IsBlank(LookUp(CalendarEvents, EventDate >= selectedDate && EventDate < DateAdd(selectedDate, 1, Days)))
)


Result: Delegation warning encountered.

- Using `With` to create date range:

With(
{
startOfDay: DateValue(Text(selectedDate, "[$-en-US]yyyy-mm-dd")),
endOfDay: DateAdd(DateValue(Text(selectedDate, "[$-en-US]yyyy-mm-dd")), 1, Days)
},
Filter(
CalendarEvents,
EventDate >= startOfDay && EventDate < endOfDay
)
)

Result: Delegation warning encountered.

 

3. Navigation Buttons:
- Previous Day Button's `OnSelect`:

Set(selectedDate, DateAdd(selectedDate, -1, Days));

- Next Day Button's `OnSelect`:

Set(selectedDate, DateAdd(selectedDate, 1, Days));

4. Displaying the Selected Date:
Text(selectedDate, "[$-en-US]dd mmm yyyy")

Errors/Issues Encountered:
- Delegation warnings consistently appear regardless of the approach.
- Unable to filter and navigate events by date without encountering delegation issues.

 

Request for Assistance:
- How can I filter calendar events by a specific date in a fully delegable manner using a SharePoint calendar list?
- Are there any best practices or alternative approaches to achieve this functionality without delegation warnings?

 

Thank you in advance for your help!

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @kuspaar ,

    What exactly is selectedDate - if it is a Variable in Date format, then this should be Delegable

    With(
     {
     _Date:
     DateAdd(
     selectedDate, 
     1, 
     TimeUnit.Days
     )
     },
     Filter(
     CalendarEvents,
     EventDate >= selectedDate && 
     EventDate < _Date
     )
    )

    if it is a Date Picker, then you need this

    With(
     {
     _Date:
     DateAdd(
     selectedDate.SelectedDate, 
     1, 
     TimeUnit.Days
     )
     },
     Filter(
     CalendarEvents,
     EventDate >= selectedDate && 
     EventDate < _Date
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • kuspaar Profile Picture
    29 on at

    Hi @WarrenBelz 

     

    Thanks for your prompt response. 

    The 'selectedDate' is my variable I use in my apps onstart: Set(selectedDate, Today());

     

    I used your suggested code and it returned delegation warning. Please see attached ss. 

    I wonder how power app realized its own calendar template without any delegation issues, yet here is a bit strugglesome... Thank you! 

    calendar error2.PNG
    calendar error1.PNG
  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @kuspaar ,

    Apart from missing a closing bracket, it should be Delegable (it is when I test it here) however if Today is the Variable, try this

    With(
     {
     _Date:
     DateAdd(
     Today(), 
     1, 
     TimeUnit.Days
     )
     },
     Filter(
     CalendarEvents,
     EventDate >= Today() && 
     EventDate < _Date
     )
    )

    This also tests fine here using a Date field on my test list

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • kuspaar Profile Picture
    29 on at

    Thank you @WarrenBelz . 

    Looks like something wrong on my side or how the sharepoint calendar is configured, though i have verified that Start Time column is of Date and Time type (named EventDate), I still get the delegation warning. Whenever i have 'EventDate' or '>=' or '&&' it triggers delegation warning. 

    I might just drop the idea of integrating the calendar in my power app... Thank you for your time and efforts!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard