Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Power Apps delegation warning: "The highlighted part of this formula might not work correctly on large data sets"

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

Power Apps marks a formula with "Delegation warning. The highlighted part of this formula might not work correctly on large data sets." when part of the query cannot be sent to the data source to run there. Microsoft's delegation page says that for a nondelegable query "Power Apps gets the first 500 records from the data source and then runs the actions in the query". A formula over a bigger table can therefore miss rows without any error. The fix is to rewrite the highlighted part with functions and operators that the data source can delegate. Raising the Data row limit only moves the cut-off.

What the warning means

Delegation means Power Apps sends a query that the data source understands, and the data source runs it. Microsoft's page says a query is nondelegable if it uses a feature the data source does not support, and "If any part of a query expression is nondelegable, Power Apps doesn't delegate any part of the query." A nondelegable query is run inside the app on the first 500 records by default. The Data row limit can be changed from 1 to 10,000 under Settings > General.

The warning is a blue wavy underline on the formula and a yellow triangle by the control. The page says the underline appears if the data in your data source exceeds 500 records and a function isn't delegated. Warnings appear only on formulas that use delegable data sources. Microsoft's Filter, Search and LookUp page says that when complete delegation of a formula isn't possible, the authoring environment flags the portion that can't be delegated with a warning.

The Power Fx source at release 1.2.0 (22 December 2023) carries these messages, among others:

  • "Delegation warning. The "{0}" part of this formula might not work correctly on large data sets." Here {0} stands for the part of the formula.
  • "Delegation warning. The highlighted part of this formula might not work correctly with column "{0}" on large data sets." This names a column.
  • "Delegation warning. The highlighted part of this formula might not work correctly on large data sets. The "{0}" operation is not supported by this connector." This names an operation.

The same file carries the longer explanation: "The data source might not be able to process the formula and might return an incomplete data set." Its fix hints say to reset the limit if the data set "exceeds the 500 record limit but contains less than 2,000 records", to simplify the formula, or to move the data to a different data source. The Learn page gives the range of the limit as 1 to 10,000, which is the figure to use.

Collections behave differently. The page says that With, UpdateContext and Set create collections internally, that collections can't take part in delegation, and that "You don't see a delegation warning." Imported Excel workbooks, collections and context variable tables are already in memory, so they need no delegation.

Likely causes

Cause What you see How to confirm
A function the source cannot run inside Filter, such as Left, Mid, Len, Lower or Upper Warning on the part that uses it; results stop at the row limit The hover message names it, as in "Mid and Len can't be delegated to any data source"
An operator that is not delegable for that column type, for example <> or IsBlank on SharePoint text Warning on one condition Compare with the connector's delegable table
in against a column of a related table Warning on the in condition The page says in is delegated only for columns on the base data source
A source that does not support delegation No warning on a collection, but only part of the data The data source type against the page's list
Data row limit set low Fewer rows than expected, with or without a warning Settings > General > Data row limit

Prove the cause before changing anything

All of these steps only read.

  1. Read the message. Hover over the yellow triangle or the underlined part. Microsoft's page shows this message for a SQL Server example: "SQL Server is a delegable data source, and Filter is a delegable function. However, Mid and Len can't be delegated to any data source." A good result names one function or operation you can replace.
  2. Check the data source. The page lists Dataverse, SharePoint, SQL Server and Salesforce as popular delegable sources, and says a delegable source's connector documentation explains its support.
  3. Check the part against the connector's table. For SharePoint, Microsoft's table shows StartsWith as delegable for text and the relational operators <, <=, <>, > and >= as not delegable for text. It says expressions joined with And or Or are delegable and Not won't delegate.
  4. Read the Data row limit under Settings > General.
  5. Count the rows in the source and compare them with the limit. The page says that below 500 records the formula "works perfectly", because the records are all brought to the device and the filter runs locally.

Example (illustrative): at Example Pty Ltd, a SharePoint list Jobs holds 12,000 items. A gallery uses Filter(Jobs, Left(Title, 3) = "ABC"). Left is a string manipulation function that the page leaves out of its delegable list, so the whole Filter runs on the first 500 rows. That leaves 12,000 − 500 = 11,500 items never examined, or 11,500 ÷ 12,000 = 95.8 per cent. A job in position 501 or later is never returned. Raising the limit to the maximum of 10,000 would examine 10,000 ÷ 12,000 = 83.3 per cent, still short.

Fix

Microsoft's delegation page says to build queries only from functions that can be delegated, which means rewriting the highlighted part. The page lists as delegable Filter, Search, First and LookUp, with And, Or, Not, =, <>, >=, <=, >, <, +, -, TrimEnds, IsBlank, StartsWith and EndsWith, constants that are the same for every record, and Sort and SortByColumns on a single column name. It says that its delegable list doesn't include If, *, /, Mod, Text, Value, Concatenate and &, Lower, Upper, Left, Mid and Len, and that all other functions can't delegate, naming FirstN, Last, LastN, Choices, Concat, Collect, ClearCollect, GroupBy and Ungroup. Each data source supports a subset, so check the warning after each change.

Write down the current formula of the gallery's Items property and the time.

Risk: Editing the formula of a live control makes the gallery return a different set of rows, a complete one instead of the first 500 rows scanned. Users who relied on the partial list will see more records. The rewrite is not guaranteed to return the same rows as the old formula; our own reading is that a prefix test with StartsWith matches a prefix test with Left, so compare results on your own data.

In the example, replace the formula with:

Filter(Jobs, StartsWith(Title, "ABC"))

To undo it, set the Items property back to the formula you wrote down. The change you made is lost, the warning returns, and the gallery goes back to scanning the first 500 rows.

Check that the yellow triangle is back.

When a column or function has no delegable form, the message hints in the Power Fx file say to simplify the formula or to move the data to a different data source, and the delegation page says Dataverse supports more query features than Excel. Our own reading: a table that will always stay under the limit can keep a nondelegable formula.

To change the limit, write down the current value of the Data row limit and the time.

Risk: Changing the Data row limit applies to the whole app. The page says a larger number can degrade performance, especially for wide tables with many columns, and it does not make a formula delegable. It also changes what every nondelegable formula in the app returns. Use it only when the table will never exceed the new limit.

Under Settings > General, set Data row limit to the new number, from 1 to 10,000.

To undo it, set Data row limit back to the value you wrote down. The change you made is lost, and nondelegable formulas go back to scanning the earlier number of rows.

Check the value under Settings > General.

Microsoft's page also describes setting the limit to 1 while testing, so that anything that cannot be delegated returns a single record that is easy to spot, which helps avoid surprises when a proof-of-concept app moves to production.

Confirm the fix

  1. The underline and the yellow triangle are gone from the formula.
  2. In the example, search for a job you know sits beyond position 501, such as one of the last items added. It now appears.
  3. Compare the number of rows shown with a count taken at the source for the same filter.
  4. Hover over the other controls on the screen. Each formula over a large table should be free of the warning.

What to watch afterwards

  • Lists that grow towards the limit. Past 500 rows a nondelegable formula starts returning partial results, whatever it did before.
  • New formulas that add If, &, Left, Lower or a lookup path to a Filter.
  • A data source or connector change. Delegable tables are per connector.
  • Raising the limit as a habit. The arithmetic above shows a raised limit still leaves rows unexamined.

Risks and limits

  • These commands have not been run or lab-tested.
  • The warning appears only for delegable data sources. For an imported Excel table or a collection there is no warning, and the data in memory is processed fully.
  • The message text comes from Power Fx release 1.2.0 and may differ from today's Power Apps wording. Microsoft's delegable lists change by connector; check the current pages.
  • A query that mixes delegable and nondelegable parts is not delegated at all, so one Left can undo the benefit of a delegable StartsWith next to it.
  • For a different volume limit, see Power BI "The received uncompressed data on the gateway client has exceeded the limit": the 10 GB refresh limit.

Sources