User profile fields: Get count of fields with value XYZ All user profiles contain these fields:


field_age (integer)
field_category (list: "Category A", "Category B", …, "Category Z")


I want to get the number of users with the value "Category A", "Category B" etc. for the landing page.

How can I get the count of users for each answer? I want to display the number on the landing page for every visitor.



The data does not need to be live data. It may be read from a file that is re-generated every 24 hours.
You can create a view as a block using users as the base table (Structure>Views>Add View and set show=Users and check "Create a Block").  Then turn aggregation on in the advanced settings. Then add the field_category field and select "Group Field". Next add field_category a second time and select "Count". This should give you a column of each category, and the count of how many users exist in each category.

Finally, add the block to the frontpage in the Block Layout.