Hi Nithish,
Maybe you can create a dataview around your grid with a microflow datasource and a non-persistent (NPE) helper entity (NPE) as return parameter. In your microflow do a retrieve on the entity used for your grid (make sure to match any xpath constraints) directly followed by a aggregate list action with a count. Create the NPE and set an attribute with the count.
Now you can use this attribute above your grid to display the total count of objects in your database.