Filter on a Boolean in PowerApps

PowerappsOne of the spots where I see a lot of people being challenged when they first learn PowerApps is the concept of delegation. Delegation comes into play when working with data sources larger than 500 records. By default PowerApps is designed to only work on a maximum of 500 records at a time. You can increase this default setting to a maximum of 2,000, but that usually results in a noticeable performance lag in your PowerApp. To avoid that problem you should always limit the number of records you are retrieving from a data source to 500 records or less. One of the most common ways to do that is by using the Filter() function to limit the records being returned by the data source to a specific subset that you want to work on.

Using Filter() to limit the number of records retrieved from a specific data source is a great strategy, but it doesn’t always work. This is where understanding the concept of delegation becomes critical. Delegation is the process of having the data source filter the records before they are returned to the PowerApp instead of having the PowerApp apply the filter directly. This is complicated by the fact that not all data sources support delegation and different data sources support different logical operators for delegation. You can find a list of delegable data sources and operators here: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-list. But even this documentation can lead to confusion.

The confusion comes in from some footnotes in the ‘Filter and LookUp delegable predicates’ section of the documentation. Footnote 3 on the logical operators reads, “For numeric columns, all operators can be delegated. For ID columns, only the ‘=’ can be delegated. Date columns can’t be delegated.” This would imply that all the operators should work with a Boolean value of true or false. But in my experience Boolean columns are treated the same way that ID columns are treated. The only operator that works is ‘=’. If you try to use a Filter statement where a Boolean value is not equal to something you will see that it issues a delegation warning. The following screenshot shows an example.

PowerApps1Blog

But if I change the formula to the Boolean being equal to true then the delegation warning goes away and the function becomes delegable. See the screenshot below.

PowerApps2Blog

The moral of the story is that understanding the intricacies of delegation is critical when building PowerApps.

Published by

Paul Papanek Stork

I am a SharePoint MVP who has specialized in Microsoft products since the mid-1990s. As a "Jack of all Trades" I have developed expertise as a network administrator, developer, and DBA. I works as a consultant/trainer where my breadth of knowledge makes me ideally suited to combine Administrative, Development, and SharePoint Designer topics. My 20+ years of experience and broad background make me a much sought after resource for SharePoint questions that cross traditional boundaries. I was a contributing author to the Developer's Guide to Windows SharePoint Services v3 Platform and the SharePoint Server 2007 Deployment Best Practices. My most recent book, the MCTS Windows SharePoint Services 3.0 Configuration Study Guide: Exam 70-631, was released in October, 2009.