Counting number of specific elements in a room / space

I’m able to read the elements, but I can’t seemd to sort them by room name.
I want the number of elements in the room, not the number of rooms…