web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Length Function for Ov...
Power Automate
Unanswered

Length Function for Overall Row Count on a Dataverse Table

(0) ShareShare
ReportReport
Posted on by 690

Hey all - I'm trying to do a really simple flow to just count the number of records in a Dataverse table  - all I'm doing is this 

length(outputs('List_rows')?['body/value'])

 

Problem is it gives me the wrong number  -I get 5000 and I know for a fact there are 15000 in the table. What am I missing? 

Thx

ctedesco3307_0-1680957303267.png

 

Categories:
I have the same question (0)
  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    By default, List rows will only return the first 5000 items. You'll need to go into the Settings of the action, turn on Pagination and set a Threshold larger than the number of items in your table. This will return the items in batches of 5000 up to the Threshold you have set.

     

    grantjenkins_0-1680957961670.png

     

    grantjenkins_1-1680957973548.png

     

  • ctedesco3307 Profile Picture
    690 on at

    @grantjenkins  - ugh... so simple!! thank you! perfect 

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @ctedesco3307 

     

    Thanks for answering @grantjenkins 

     

    Interesting question and I tested this with 6000 records. Get Items action step with no threshold returned me 100 records. I set the pagination to 10,000 and it returned me 6000 records as records count. 

     

    In-depth analysis into 'Get items' and 'Get files' SharePoint actions for flows in Power Automate | Microsoft Learn

     

    The above documentation says 5000 is the limit for the filter query. I did tested with a filter query Id greater than 0 and it did returned me 6000 with the threshold settings to 10,000. Without threshold it did returned 100. 

     

    A bit confused about 5000 limit here? Do I need more records to test this @grantjenkins ?

     

    For finding only the total record count I did used the REST API query and it did returned 6000 record count.

     

    image.png

     

    image.png

  • grantjenkins Profile Picture
    11,063 Moderator on at

    @abm I didn't quite say the correct thing in my previous post. List rows (Dataverse) and Get items (SharePoint) both retrieve the first 100 items by default (if left blank). You can increase this up to 5000 using Top Count.

     

    If you then turn on Pagination, it will start to return your items in batches of what you've set for Top Count, up to the Threshold you specified. Some examples below.

     

    Example 1:

    Settings:

    • Top Count = blank
    • Pagination = Off

    Result:

    • You will get up to 100 items returned.

     

    Example 2:

    Settings:

    • Top Count = 5000
    • Pagination = Off

    Result:

    • You will get up to 5000 items returned.
    • In order to get more than 5000 items you need to turn on Pagination so it will retrieve the items in batches up to the Threshold you set. This is why it's stated that the maximum is 5000 (5000 per batch).

     

    Example 3:

    Settings:

    • Top Count = blank
    • Pagination = On
    • Threshold = 15000

    Result:

    • You will get up to 15000 items returned in batches of 100.
    • If you had a total of 12000 items that would be returned, then this would go back to your SharePoint list 120 times (120 x 100 = 12000).

     

    Example 4:

    Settings:

    • Top Count = 5000
    • Pagination = On
    • Threshold = 15000

    Result:

    • You will get up to 15000 items returned in batches of 5000.
    • If you had a total of 12000 items that would be returned, then this would go back to your SharePoint list 3 times (3 x 5000 = 15000 which is more than 12000). Much quicker than just leaving the Top Count blank.

     

    Note 1: If you're potentially going to receive more than 5000 items, you should set your Top Count to 5000 (max batch size) and turn on Pagination.

     

    Note 2: List rows present in a table (Excel) has a default of 256 items returned. Same conditions as above apply here too, except 256 if Top Count is blank instead of 100.

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @grantjenkins 

     

    Thanks for your reply. My understanding is if you have large data sets to process then setting the pagination always helps. Batch by batch you can deal with the data rather than one is whole go in terms of memory and  other resources. 

     

    If I want to use the total count for the records I would use the REST API way which I explained earlier in my post.

     

    Thanks again.

     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    @abm Agreed - using the Rest API is probably a better solution here to get the item count. I'd probably do some testing though as using ItemCount in PowerShell sometimes doesn't give the exact count as it's cached. Not sure if the same in Power Automate and the Rest API.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard