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 warning - “...
Power Apps
Unanswered

Delegation warning - “sum” operation

(1) ShareShare
ReportReport
Posted on by 26

Hello,

 

I’m new to Power Apps, so I’ve been following a tutorial, but though I’ve followed it step by step, when I type the following into the formula bars for a couple of buttons (OnSelect), it’s not working for me, although it does work in the tutorial.

 

I’ve gone over it to see if I made any mistakes copying it, but as far as I can tell, I haven’t. And I’ve tried googling but I can’t seem to find anything, and because I’m new I have no idea what to try next, so any help is greatly appreciated.

 

I’ve tried to include all the relevant information, but if I have accidentally left anything out, please don’t hesitate to ask me, and if I can I’ll let you know. 

 

The issue seems to be the same for all of them, but with slight differences. All of them identify the error as being related to the `=` signs used.

 

In one formula box, I have:

 

Sum(Filter('Leave Balance',LeaveId=ThisItem.LeaveId),'Total Leave')-Sum(Filter(LeavesAppliedByUsers,LeaveId.Value=ThisItem.LeaveId && RequestedBy.Email=User().Email),TotalDays) &" Days"

 

When I hover over the first `=` sign, ('Leave Balance',LeaveId=ThisItem), it comes up with ‘Delegation warning. The highlighted part of this formula might not work correctly on large data sets. The “Sum” operation is not supported by this connector.

Incompatible types for comparison. These types can’t be compared: Record, Record.’

 

When I hover over the second `=` sign, (LeavesAppliedByUsers,LeaveId.Value=ThisItem), it comes up with ‘Delegation warning. The highlighted part of this formula might not work correctly on large data sets. The “Sum” operation is not supported by this connector.

Incompatible types for comparison. These types can’t be compared: Text, Record.’

 

Then at the very bottom of the formula bar it says – ‘ “ Days” = There is an error in this formula. Try revising the formula and running it again.’

 

And in another formula bar, I have:

 

ClearCollect(LeaveSum,Sum(Filter(LeavesAppliedByUsers,LeaveId.Value=Gallery5_1.Selected.LeaveId && RequestedBy.Email=User().Email),TotalDays));

 

ClearCollect(TotalLeave,Sum(Filter( 'Leave Balance',LeaveId=Gallery5_1.Selected.LeaveId),'Total Leave'));

 

When I hover over the third `=` sign, (LeavesAppliedByUsers,LeaveId.Value=Gallery5_1) it comes up with ‘Delegation warning. The highlighted part of this formula might not work correctly on large data sets. The “Sum” operation is not supported by this connector.

Incompatible types for comparison. These types can’t be compared: Text, Record.’

 

When I hover over the fourth `=` sign, ('Leave Balance',LeaveId=Gallery5_1), it comes up with ‘Delegation warning. The highlighted part of this formula might not work correctly on large data sets. The “Sum” operation is not supported by this connector.

Incompatible types for comparison. These types can’t be compared: Record, Record.’

 

As I’ve said, any help would be greatly appreciated. Apologies if any similar questions to this have already been posted and answered, I’ve had a look around and I couldn’t find anything, but I might have just missed something.

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Charlotte17 

    Sum is not a delegable function.

    If your datasource will not grow over 2000 items, then you can ignore the warning.

     

    However, you can use the function by prefiltering your data.

    Please consider changing your Formula to the following:

    With({_leave: Filter('Leave Balance',LeaveId=ThisItem.LeaveId),
     _applied: Filter(LeavesAppliedByUsers,LeaveId.Value=ThisItem.LeaveId && RequestedBy.Email=User().Email)},
     Sum(_leave,'Total Leave')-Sum(_applied,TotalDays) & " Days"
    )

    In this scenario we are applying a filter to a scoped With variable.  Then the Sum formula is running against an in-memory table in the two variables - delegation is never an issue with in-memory tables.

     

    I hope this is helpful for you.

  • Charlotte17 Profile Picture
    26 on at

    Hi,

    Thank you so much for replying. 
    I’ve tried what you advised, and it’s sorted out the delegation issue, thank you. However, it’s still saying ‘incompatible types for comparison. These types can’t be compared: Text, Record’. 
    Do you have any thoughts on what I can do to address this, or why this is happening? 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Charlotte17 

    I am going to make the guess that it is on the LeaveId part of your formula.  

    What type of column is LeaveId in your list?

     

  • Charlotte17 Profile Picture
    26 on at

    It’s from a SharePoint list and the type is Lookup

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Charlotte17 

    Is that for both lists??

     

    Yes, so in your formula you are using .Value on the left side of the equal - which will be the text value of the Lookup column (the primary referenced field as defined in SharePoint).

    On the right side, you are using LeaveId, which, if your Gallery records are based on the same list, then ThisItem.LeaveId is going to be a record (with both the Id and the Value of the Lookup)...you can't compare those two.

    So, making a fairly good guess on what you have, your formula should be this:

    With({_leave: Filter('Leave Balance', 
     LeaveId.Id = ThisItem.LeaveId.Id),
     _applied: Filter(LeavesAppliedByUsers, 
     LeaveId.Id = ThisItem.LeaveId.Id && 
     RequestedBy.Email=User().Email)
     },
     Sum(_leave,'Total Leave')-Sum(_applied,TotalDays) & " Days"
    )

     

  • Charlotte17 Profile Picture
    26 on at

    Hi,

    Thank you, I’ve tried what you suggested, and it’s now working a little, so I’m just going to have to keep experimenting with it. 

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard