In order to count items stored in your entity I normally use a non-persistent entity that is counting the items based on the selection of the user. The non-persistent entity holds a attribute for example “total” what can be displayed on the page.
The calculation in that case is done with a Microflow before entering the page