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 / Handling Delegation in...
Power Apps
Unanswered

Handling Delegation in Formula

(0) ShareShare
ReportReport
Posted on by 473

My formula below filters Desks that are available for by looking up to an associated entity 'Reservation Details' , if it has already been booked for a selected date range.

Filter(
 Filter(
 'Bookable Desk',
 Area.'Area (hsl_areaid)' = Area_Ddl.Selected.'Area (hsl_areaid)' && Facility.Facility = Building_Ddl.Selected.Facility && !IsBlank(XCoor) && !IsBlank(YCoor)
 ) As AllDesks,
 !(AllDesks.Name in ForAll(
 Filter(
 'Reservation Details',
 Date >= FromDate_Dp.SelectedDate,
 Date <= ToDate_Dp.SelectedDate && ('Booking Status' = 'Booking Status (Reservation Details)'.Blocked || 'Booking Status' = 'Booking Status (Reservation Details)'.Booked)
 ),
 'Reserved Desk'.Name
 ).Value) && !(AllDesks.Name in SelectedSeatBookedBySomeone.ItemName)
)

 

I encountered a delegation issue today as my 'Reservation Details' records exceeded 2000.

As my formula contains multiple conditions across 2 entities, would there be suggestions on how I can optimize my formula to prevent data loss due to delegation record limit? I read of querying via 'Views', but it seems unlikely due to my conditions. 


1) Desk entity

- Area (associated lookup)

- Facility (associated lookup)

 

2) Reservation Details entity

- Start Date

- End Date

- Selected Desk (lookup to (1) Desk)

- Booking Status

Thank you for any help given.

Categories:
  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    Hello,

    Hope you're doing well. Can you kindly specify the which Database are you using in your application?

    Can you please add screenshot of the code from Formula bar and detail delegation warning.

    Delegation can be a really tricky part especially when filtering the dataset. Make sure to use formulas that can handle delegation and sometimes delegation can be due to a simple issue for example comparison of different data types etc

  • ruihaolrh Profile Picture
    473 on at

    Hi @ShaheerAhmad , I am using Microsoft Dataverse as my data source. No external connections such as SQL or SP is used.

    gymcode_2-1707115203664.png

    The screenshot of my code is as follow:

    gymcode_0-1707115080461.png

    The delegation warning message is shown as follow:

    gymcode_1-1707115116789.png


    Previously, the "!" highlighted in yellow did show a delegation warning, but it is not showing now.
    Edit: This was the previous formula that indicates a delegation error for the "!":

    gymcode_3-1707115309646.png

     

  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    Instead of using !() try using Not() function

  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    Also Excel is not a suitable database for large set of data. I suggest you to use Dataverse.

  • ruihaolrh Profile Picture
    473 on at

    Hi @ShaheerAhmad , I am using Dataverse instead of Excel as my dataset.

    Also, I will try Not() instead of !()

  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    Sorry my bad. Maybe I misread. Yeah in this scenario also make sure that the ForAll function you're using is retuning an array and not a JSON array. Because you're using "IN" operator
    ["asd", "sdsd", "sds"]
    and not
    [{name:"vdv",value:"sdsd"},{name:"vdv",value:"sdsd"}]

    You can verify this by highlighting the ForAll Code and the preview of the returned Table should contain not more than one column

  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    Make sure to mark the post as solution if it solves your issue

  • ruihaolrh Profile Picture
    473 on at

    Hi @ShaheerAhmad , there are several places that the delegation warning appears. I replaced "!" with "Not", but encountered the following error:

    gymcode_0-1707117294896.png

     

  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    I guess we should revert to "!" then. Have you validated the output of the forall loop?

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard