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

How to Get Data from Dataverse in Power Apps (Gallery, LookUp, CountIf)

If you’ve tried counting a Dataverse table in Power Apps with CountRows, you’ve probably seen a 0 while the table holds 8 rows. To get data from Dataverse in Power Apps reliably, add the table, then read it with Filter, LookUp and CountIf.

Why the 0? CountRows on a Dataverse table reads a cached count that Dataverse only updates now and then, so it can lag behind your real data.

In this tutorial, we’ll get data from Dataverse in Power Apps step by step. We’ll connect a table to a blank canvas app, show filtered rows in a gallery, and read one record with LookUp.

Then we’ll count rows the right way, spot delegation warnings, and refresh the data. Every formula here ran in my own app on 10/21/2026.

The Sample Table We’ll Use

Every example reads one table, Service Requests, in my Power Platform developer environment. If tables, rows and columns are new to you, start with what Microsoft Dataverse is.

Dataverse is Microsoft’s database for the Power Platform. A table holds rows (records), and each column has a type, like text, choice or lookup.

ColumnTypeNote
SubjectText (primary column)Password Reset, Network Issue …
Request Number TextREQ-1000 to REQ-1009; display name ends with a space
StatusChoiceOpen, In Progress, Closed
PriorityChoiceLow, Medium, High
CustomerLookupPoints to the Customers table (Amy, Bob, Cleo, Dan, Eve)

During these tests the table had 8 rows, from Hardware Repair (REQ-1000) to Monitor Flicker (REQ-1009). Four were Open: Password Reset, Software Update, Projector Setup and Monitor Flicker.

Connect a Dataverse Table to Your Canvas App

Here’s the beginner path. Dataverse lives inside an environment, so pick the right one first.

  1. Go to make.powerapps.com and choose your environment at the top right.
  2. Select Create > Start with design > Blank canvas app, pick the Tablet format and select Create.
  3. In Studio, open Data in the left bar and select Add data.
  4. Type the table name in the search box. Dataverse tables show Microsoft Dataverse – Current environment under the name.
  5. Select the table. That’s it: there’s no separate connection to set up, unlike SharePoint or Excel.

I searched for Service Requests. Hovering the result shows the logical name, cr85a_servicerequest, which helps when two tables share a display name.

Power Apps Studio Add data search showing the Service Requests Microsoft Dataverse table

That last tip saved me once. Searching Customers showed two Dataverse tables with the same name, and only the tooltip told them apart.

By default the app reads the current environment. Microsoft’s docs say you can use Change environment for another one, and your security role still decides which rows you can see.

You may have seen the older route too: Start with data builds a three-screen app (browse, detail, edit) from one table. It’s quick, but you learn more building screens yourself. Browse more in our Power Apps tutorials hub.

Pro Tip: Save often with Ctrl+S, and press F5 (or the Play button at the top right) to run the app in Preview. In the editor, hold Alt and click a button to run it without leaving edit mode.

Method 1: Show Dataverse Rows in a Gallery With Filter and Sort (Recommended)

Use this when people need to browse and search rows. I added a dropdown ddStatus, a text input txtSearch and a vertical gallery galGet from the Insert menu.

The dropdown’s Items is Choices('Status (Service Requests)'), so it lists Open, In Progress and Closed.

Next, select the gallery, pick Items in the property dropdown left of the formula bar, and paste this:

Sort(
    Filter('Service Requests',
        'Status (cr85a_status)' = ddStatus.Selected.Value,
        StartsWith(Subject, txtSearch.Text)),
    'Request Number ', SortOrder.Ascending)

Studio showed no delegation warning for this formula, which is exactly what you want.

Gallery Items formula in Power Apps using Sort Filter and StartsWith on Service Requests

With Status Open and an empty search box, the gallery showed four rows: Password Reset (REQ-1003), Software Update (REQ-1004), Projector Setup (REQ-1008) and Monitor Flicker (REQ-1009).

Typing P in the search box cut that to Password Reset and Projector Setup.

Power Apps Preview gallery filtered to Open status with search P showing two Dataverse rows

How does this work?

Filter keeps rows where both conditions are true. The first compares the Status choice to the dropdown’s selected value, and the second keeps subjects starting with the search text.

An empty search box matches every subject, so you see all Open rows. Sort then orders them by request number, A to Z.

Filter, Sort, StartsWith and = on a choice are all delegable to Dataverse. That means Dataverse runs the query on the server, so the gallery works on 8 rows or 80,000.

So here’s the catch: our table has two columns called Status. Every Dataverse table has a system Status (Active/Inactive), so Power Apps renames ours to 'Status (cr85a_status)'. I explain the clash when I cover Dataverse choice columns in Power Apps.

Show a Lookup Column in the Gallery

Customer is a lookup to another table, so the gallery row doesn’t hold a name, it holds a related record. Use dot notation to reach the column you want:

ThisItem.Customer.'Customer Name'

The label showed Cleo, Eve and Bob for the Open rows. This only works after you add the Customers table to the app too, the same way you added Service Requests.

Method 2: Get One Record With LookUp

Use LookUp when you need one row, like a request someone picked in another screen. It returns the first record that matches, or one value from it.

Here’s the formula on a label’s Text property:

LookUp('Service Requests', 'Request Number ' = "REQ-1006").Subject

The label showed Network Issue, the subject of REQ-1006.

Power Apps LookUp formula returning Network Issue for request number REQ-1006

How does this work?

LookUp checks each row against the condition and stops at the first match. .Subject then pulls just that column out of the record.

Leave off .Subject and you get the whole record, which is handy in a variable: Set(varReq, LookUp(...)). If nothing matches, LookUp returns blank.

Now look at the column name: 'Request Number ' has a space before the closing quote. Its display name has a trailing space, so 'Request Number' gave “Name isn’t valid.”

For more on picking the right function, see Filter vs Search vs LookUp in Power Apps.

Method 3: Count Dataverse Rows With CountIf Instead of CountRows

This is the symptom from the top. I put CountRows('Service Requests') on a label, and Studio showed a warning:

CountRows may return a cached value. Use CountIf(DataSource, true) to get the latest count.

The label read 0 in Studio and in Preview. A second label with this formula showed 8, the real count:

CountIf('Service Requests', true)
CountRows cached value warning with label 0 next to CountIf showing 8 Dataverse rows

How does this work?

Dataverse keeps a cached row count per table and updates it periodically. CountRows on the whole table reads that cache, so a new or recently filled table can show a stale number, like my 0.

CountIf(table, true) counts rows where the condition is true, and true is true for every row. Microsoft’s docs recommend it for exact counts under 50,000 rows.

CountRows works fine on a filtered table or a gallery, like CountRows(galGet.AllItems). For more examples, see our Power Apps CountIf function guide.

Pro Tip: If CountIf still shows a delegation warning on a big table, check Settings > Upcoming features for Enhanced delegation for Microsoft Dataverse. Microsoft’s docs say it’s needed for CountIf and CountRows delegation.

Watch for Delegation Warnings When You Read Dataverse

Delegation means Power Apps hands the query to Dataverse. When a function can’t be delegated, Power Apps downloads only the first 500 rows (the default data row limit) and works on those.

Here’s a formula that looks harmless:

CountRows(Filter('Service Requests', Len(Subject) > 12))

It returned 6, which is right for 8 rows. But Studio drew a blue squiggle and two warnings: the “Len” part might not work correctly on large data sets, and neither might the Subject column.

Delegation warning on Len in a CountRows Filter formula against the Service Requests table

How does this work?

Dataverse can’t run Len on the server, so Power Apps would check only the rows it downloaded. On 8 rows that’s everything. On 5,000 rows, you’d get a wrong count with no error.

The fix is to filter on something Dataverse understands, like StartsWith, = or a date range, or store the value in its own column. I walk through more fixes in Power Apps delegation warnings.

Refresh Dataverse Data in Power Apps

Galleries don’t reload on their own when someone else changes a row. Put this on a button’s OnSelect to get a fresh copy:

Refresh('Service Requests')

Refresh works only in behavior formulas, like OnSelect or OnVisible, and returns nothing. Galleries bound to the table then show other users’ changes.

Here’s what it doesn’t do: my CountRows label still said 0 after Refresh. The cache lives in Dataverse, not the app, so CountIf is the fix. More patterns are in our Power Apps Refresh function post.

Need the same data outside the app? A flow can count rows from a Dataverse table with List rows, and you can add data to a Dataverse table from Power Apps with Patch.

Which Method Should You Use?

You needUseDelegable?
A searchable list of rowsGallery Items = Filter + StartsWith + SortYes
One row or one valueLookUp(table, condition).ColumnYes
Exact number of rowsCountIf(table, true)Yes, up to 50,000 rows
Number of rows on screenCountRows(gallery.AllItems)Counts loaded rows
Other users’ latest changesRefresh(table) on a button–

Things to Keep in Mind

  • CountRows on a whole Dataverse table can show a stale number (I got 0). Fix: use CountIf(table, true).
  • Display names can hide spaces, like ‘Request Number ‘. Fix: pick the column from IntelliSense instead of typing it.
  • A custom choice called Status clashes with the system Status. Fix: use ‘Status (cr85a_status)’ in formulas.
  • Len, Trim and Text() on a column aren’t delegable. Fix: filter with StartsWith, =, or a stored column.
  • Lookup columns return a record. Fix: add the related table and use ThisItem.Customer.’Customer Name’.

If you build Dataverse apps at work, our Power Apps training course covers these patterns on real projects.

Want to go further with Dataverse? These pair well with this one:

Frequently Asked Questions

How do I use Dataverse in Power Apps?

Create a canvas app in the environment that holds your tables, open Data, select Add data, and pick the Dataverse table. Then use its name in formulas, like a gallery’s Items property or LookUp. No separate connection is needed.

How do I get a single record from a Dataverse table in Power Apps?

Use LookUp, for example LookUp(‘Service Requests’, ‘Request Number ‘ = “REQ-1006”). It returns the first matching record, or one column if you add .Subject. If nothing matches, it returns blank.

Why does CountRows show 0 or the wrong number for my Dataverse table?

CountRows on a whole Dataverse table reads a cached count that updates periodically. Use CountIf(table, true) for the exact count under 50,000 rows. See Microsoft Learn on CountIf and CountRows.

Which functions are delegable for Dataverse in Power Apps?

Filter, Sort, LookUp, StartsWith, CountIf and comparisons like = are delegable. Len, Trim and Text() on a column aren’t. Microsoft keeps the full list in Connect to Microsoft Dataverse.

How do I access Dataverse tables from another environment?

When you add data, select Change environment and pick the other environment, then choose the tables. Your security role there still controls which tables and rows you can see.