Enhancing Canvas App Performance and Resolving Delegation Issues in Power Apps
Inkey Solutions, May 30, 2025254 Views
Canvas App is a product of the Power Platform that allows users to create custom applications for both tablets and mobile devices within an organization. It provides a better user interface (UI) experience to display and interact with data stored in a database. Canvas Apps enable the creation of applications with low-code or no-code functionality, making it usable for users with minimal technical expertise to understand and quickly learn how to use the platform.
A key feature of PowerApps is its ability to connect to different data sources, such as SharePoint, SQL Server, Dataverse, and many more. While this is convenient, one important concept users need to be aware of is delegation in PowerApps.
Delegation is critical for ensuring that your app can scale efficiently and retrieve large datasets effectively. When a query is delegable, it means the filtering, sorting, and other operations are performed at the data source level (Example, in the SQL Server or SharePoint), so the app only retrieves the necessary data, leading to better performance and a smoother user experience.
On the other hand, non-delegable queries result in:
- Limited data retrieval (only a subset of records).
- Reduced app performance, especially with larger datasets.
Below, we were facing delegation warnings related to filtering and conditions. Here are 2-4 examples to solve unwanted delegation issues in the app and enhance Canvas App performance.
Example 1:
The CountRows function provides a delegation warning when checking item counts in a condition. However, we can resolve this by using the IsEmpty function. The IsEmpty function checks if there are any records in a database table, similar to how CountRows checks the number of records in a data source.
Below is a screenshot of the delegation warning with the CountRows function.
As shown in the screenshot below, we can see that the delegation warning is removed by using the IsEmpty function.
Example 2:
Many times, we may receive a requirement to check if an item is not present on a table. However, when using the “not equal to” (<>) condition in CanvasApp, we often encounter a delegation warning when working with SharePoint lists. This issue can be resolved by using the With() function in PowerApps. The With() function retrieves the entire table into local storage and then filters it into a local collection variable.
As shown in the screenshot below, the delegation warning appears when attempting to retrieve data with a “Not Equal” (<>) condition.
As shown in the screenshot below, we removed the delegation warning by using the same condition.
Example 3:
In this example, we will resolve the app performance issue by using the OnStart property in the app.
There are two similar events in the app: OnStart and Formulas. Often, we make the mistake of defining global variables in the OnStart event. The problem with the OnStart event is that it takes time to load all global variables. A better solution is to define global variables in the Formulas event in PowerApps. The benefit of defining variables in the Formulas event is that it doesn’t take time to load them, as the Formulas event only accepts global declarations.
As shown in the screenshot below, we can define global variables in the Formulas event, as shown in the screenshot.
The use of the variable is shown in the screenshot below.
Conclusion
In PowerApps, delegation allows for more efficient data processing by leveraging server-side capabilities, but non-delegable queries can lead to issues with large datasets. The delegation warning is simply a notification to inform you that the app may not retrieve or process all the data correctly. It is crucial to design your app to minimize non-delegable queries to maintain performance and data accuracy as your app scales.