You don’t provide details, but let’s say you have a group named group.door_sensors, and each of the entities in this group have a state of off, offline, etc. Then maybe something like:
{% set doors = expand('group.door_sensors') %}
Door Sensors: {{ devs|rejectattr('state','in',('off','offline'))|list|count }}/{{ devs|count }}
If that doesn’t work then you’ll need to provide more details about your groups and the entities in them (states, attributes, whatever.)
I do remember hearing something about that, too, but I don’t know the status. Of course, the OP didn’t say what they wanted to do with the output of the template, so… They might want a template sensor, but they might not either.
Thanks for all the replies! I’ve managed to get a working solution with help from a chap on the HA Facebook community group … Here is the code: https://pastebin.com/s49zdUrY