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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to get records cou...
Power Apps
Unanswered

How to get records count of column with data in Dataverse

(0) ShareShare
ReportReport
Posted on by 74

HI 

 

1.)I need to get record count based on choice field values of specific column in dataverse table.

 

2.)Is it feasible to get the related records count based on choice column values in Dataverse.

 

Please help me to find out the way to achieve the above

 

 

Thanks in Advance

SG

I have the same question (0)
  • Jonathan Manrique Profile Picture
    2,695 on at

    Hi @SG013 

     

    There are many ways to do it, but it depends on whether you are using a Canvas App or Model Driven Apps.

    If you are using Model Driven, use the views and filter by the attribute so that you can obtain the total number of records with that characteristic. If you are using Canvas Apps you must create a collection with the dataverse table, and then you can use the countrow in a label, you can also make a countrow against the dataverse table, here you must be careful with delegation.

    Like the previous point, you can do it in various ways, the classic thing is to include within the form a subgrid of the related table and it will give you the records, then you can use JS to count the total records of that grid, or use a rollup to tell.

    You can also use the filters within the views and there you can filter by the parameters you want. Everything will depend on what you are really looking for and need, because what you need may be a Dashboard in Power Bi.

     

  • AllanDeCastro Profile Picture
    412 Most Valuable Professional on at

    Hello

    You can use the Fetch query to do this, but beware of the limitation - you might want to do a pagination instead of a grouping as below!

    Here's a sample FetchXML query to count records based on a choice field named new_choicefield in an entity named new_entity:

     

    <fetch distinct="false" mapping="logical" aggregate="true">
     <entity name="new_entity">
     <attribute name="new_entityid" alias="count" aggregate="count"/>
     <filter type="and">
     <condition attribute="new_choicefield" operator="eq" value="Option1"/>
     </filter>
     </entity>
    </fetch>

     

     

    In this example:

    • Replace new_entity with the logical name of your entity.
    • Replace new_choicefield with the logical name of your choice field.
    • Modify the <condition> element to match the specific choice field value (Option1 in this case)

    It is feasible to get the count of related records based on the values of a choice column in Dataverse. Here's a simplified example assuming a 1:N relationship from new_parententity to new_childentity:

     

    <fetch distinct="false" mapping="logical" aggregate="true">
     <entity name="new_childentity">
     <link-entity name="new_parententity" from="new_parententityid" to="new_parententityid" alias="parent">
     <attribute name="new_parententityid" alias="count" aggregate="count"/>
     <filter type="and">
     <condition attribute="parent.new_choicefield" operator="eq" value="Option2"/>
     </filter>
     </link-entity>
     </entity>
    </fetch>

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard