Here's one solution that has worked for me. I have a calculate field with this sort of expression in the calculate field:
count(instance('list_product')/root/item[string-length(name)>0])
Where "list_product" is the name of the list itself, and the "string-length(name)>0" just ensures every list item that has a length larger than 0 gets counted so basically everything.