List/Library: Get Count of Entities in SharePoint List


Is it possible to obtain a count of each entity in a SharePoint list?

For example, if I have a column called "Hospital" which then includes a list of hospital names in this column. Could I get a summary count of how hospitals are in this column in my List/Library and display this on the form?

The use-case for this is to provide a summary of the amount of forms each hospital has submitted for HR business partners.

Any guidance, links, codes will be helpful!

Many thanks!!

Dear @DryChips,
You can send pnpjs request with filter condition and get a response with a number of items, like this:

pnp.sp.web.lists.getByTitle("Test").items.filter("Type eq 'Hospital' and Parent/Id eq '" + fd.itemId + "'").getAll().then(function(allItems){
1 Like