Hi Sarita,
Here is sample of a fetchxml statement that will give you a count of category (group by). Replace the entity name and attribute name (optionset) to match your requirements.
<fetch mapping="logical" aggregate="true" >
<entity name="account" >
<attribute name="new_categoryname" alias="catname" aggregate="count" />
<attribute name="new_category" alias="cat" groupby="true" />
</entity>
</fetch>
Eric UNG [Senior Analyst Programmer :: Sydney, Australia]