Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

Power Apps ClearCollect Function (6 Practical Examples)

Here’s a bug I see in a lot of first Power Apps projects: a Load button fills a collection, and every click adds the same rows again. Click it three times and the gallery shows every request three times.

The Power Apps ClearCollect function fixes that in one call. It empties the collection and then fills it again, so the result is the same no matter how often the formula runs.

In this tutorial, I’ll show you how the power apps clearcollect function works, with six tested examples: typed records, a drop-down list, SharePoint rows, a reload on OnVisible, the 500-row limit, and the table it returns.

Power Apps ClearCollect Function Syntax

ClearCollect( Collection, Item, ... )
ParameterRequiredTypeDescription
CollectionYesCollectionThe collection to clear and then fill. It’s created if it doesn’t exist yet.
Item, …YesRecord, table or valueOne or more records or tables to add. A single value lands in a column named Value.

Return value: the modified collection as a table. Most formulas ignore it, but Example 6 uses it.

ClearCollect is a behavior function, so it only works in action properties like OnSelect, OnVisible or App.OnStart. With a data source it can’t be delegated (see delegation in Power Apps): Power Apps copies only the first batch of rows, 500 by default.

When to Use the ClearCollect Function in Power Apps

  • A Load or Refresh button that should replace rows, never append them.
  • A screen’s OnVisible that rebuilds a list each time the screen opens (OnStart vs OnVisible explains the difference).
  • A short, fixed list of choices for a drop-down.
  • A filtered local copy of a SharePoint list or Dataverse table that several controls read.

New to collections? Start with how to create a collection in Power Apps.

Example 1: Create or Reset a Collection With Records

Kevin Brooks in IT wants an equipment cart in his canvas app that starts with the same three items every time he presses a button.

Here’s where every formula in this post goes: select the control, pick the property in the drop-down left of the fx bar (OnSelect here), and type in the formula bar. To test, press Play or hold Alt and click the button.

ClearCollect formula typed in the OnSelect property of a modern button in Power Apps Studio
ClearCollect(
    colCart,
    {Item: "Laptop dock", Qty: 2, Price: 129.5},
    {Item: "Wireless mouse", Qty: 4, Price: 24.95},
    {Item: "27-inch monitor", Qty: 1, Price: 219}
)

A label below it shows the rows with the Concat function:

"Rows in colCart: " & CountRows(colCart) & Char(10) &
Concat(colCart, Item & " | Qty " & Qty & " | " & Text(Price, "$#,##0.00"), Char(10))
Preview showing colCart with three rows after the ClearCollect button was clicked three times

How does this work?

colCart is the collection, and each { } block is one record whose field names become columns. I clicked the button three times and the label still said Rows in colCart: 3.

Example 2: Load a List of Values for a Drop-Down

Maria Torres needs a Department drop-down with five fixed values. A button’s OnSelect gets:

ClearCollect(colDepartments, ["IT", "HR", "Finance", "Sales", "Marketing"])

Set the modern drop-down’s Items to colDepartments and ItemDisplayText to ThisItem.Value.

Modern drop-down in Preview listing the five departments loaded by ClearCollect

How does this work?

Each item in the brackets is a single value, so ClearCollect stores it in a Value column. The drop-down listed IT, HR, Finance, Sales and Marketing, and picking Finance showed Picked: Finance | Rows in colDepartments: 5.

Example 3: Copy Filtered Rows From a SharePoint List

Our Service Requests list on /sites/SPGuides has 623 tickets with a Status choice column. Jordan Ellis only wants the New ones:

ClearCollect(
    colNewRequests,
    Filter('Service Requests', Status.Value = "New")
)
ClearCollect with Filter on the Service Requests SharePoint list in the Power Apps formula bar
Preview showing 210 New service requests copied into colNewRequests

How does this work?

Status.Value = “New” is a condition SharePoint evaluates itself, so the filter on the SharePoint list ran server-side and Power Apps Studio showed no warning. ClearCollect replaced the collection with 210 rows, starting with Laptop replacement #1000.

Example 4: Reload a Collection When a Screen Opens

A Power Apps collection doesn’t refresh itself when SharePoint changes. Select the screen in the tree view, pick OnVisible, and type:

ClearCollect(
    colInProgress,
    Sort(
        ShowColumns(
            Filter('Service Requests', Status.Value = "In Progress"),
            ID, Title, Priority, DueDate
        ),
        DueDate,
        SortOrder.Ascending
    )
)
ClearCollect with Sort and ShowColumns in the OnVisible property of the scrFnClearCollect screen
Preview showing 207 In Progress requests sorted by due date in colInProgress

How does this work?

Filter keeps In Progress tickets, ShowColumns keeps four columns, and the Sort function puts the oldest due date first. The result: 207 rows, starting with Teams phone #1280 due 01/05/2026.

Pro Tip: Pressing Play on the screen you’re editing didn’t run its OnVisible in my test (0 rows). Navigate to the screen, or add a Reload button with the same formula, as I did.

Example 5: Why Power Apps ClearCollect Stops at 500 Rows

Now copy the whole 623-item list:

ClearCollect(colAllRequests, 'Service Requests')

A label shows the count and the highest ID:

"Rows in colAllRequests: " & CountRows(colAllRequests) & " | Highest ID: " & Max(colAllRequests, ID)
Preview showing ClearCollect copied only 500 of 623 Service Requests rows, highest ID 500

How does this work?

With no filter to delegate, Power Apps fetched only the first batch. The label read 500 rows, highest ID 500, and Studio showed no warning at all. You can raise the data row limit in Power Apps (up to 10,000), or load the list in chunks as the collection tutorial linked above shows.

Example 6: Use the Table ClearCollect Returns

Because ClearCollect returns the collection, you can count it in the same formula:

Notify(
    "Loaded " & CountRows(
        ClearCollect(colClosed, Filter('Service Requests', Status.Value = "Closed"))
    ) & " closed requests",
    NotificationType.Success
)
Green Notify banner showing that ClearCollect loaded 206 closed requests into colClosed

How does this work?

The inner ClearCollect runs first and hands its table to CountRows. The Notify function then showed Loaded 206 closed requests, with no extra variable.

ClearCollect vs Collect vs Clear

I tested all three on colCart. After Example 1 (3 rows), a button with this formula ran three times:

Collect(colCart, {Item: "USB-C cable", Qty: 3, Price: 12.99})
colCart showing six rows after Collect appended three USB-C cable rows
FunctionWhat it doescolCart in my test
CollectAdds rows, keeps old ones3 -> 6 after three clicks
ClearCollectEmpties, then adds6 -> 3
ClearRemoves every row3 -> 0

In Power Apps, use ClearCollect to load or reload, Collect to add one item, and Clear to empty a cart. To delete only some rows, see the Remove function.

Common Mistakes with the Power Apps ClearCollect Function

  • Wrong property: ClearCollect in a label’s Text gives “Behavior function in a non-behavior property. You can’t use this property to change values elsewhere in the app.” Move it to OnSelect or OnVisible.
  • Silent 500-row cap: no warning appeared on a whole-list copy, so compare CountRows with the list’s real item count.
  • No write-back: changing a collection never changes SharePoint. Use the Patch function to save.
  • Empty isn’t blank: check a zero-row collection with IsEmpty (IsBlank vs IsEmpty).
  • Names are app-wide: a collection filled on one screen is the same collection on every screen.

Wrapping Up

The Power Apps ClearCollect function is Clear plus Collect in one behavior formula, so loads and reloads never stack duplicate rows. Let a delegable Filter do the heavy lifting, and watch the 500-row limit on whole-list copies.

For more, see all Power Apps functions and the ClearCollect function on Microsoft Learn.

Other Power Apps functions you may find useful: