If you don't mind get dirty with shell scripts, take this simple example:
RAM provisioned to running VMs (in GB)
# qm list | fgrep running | awk '{s+=$4}END{print s/1024}'
RAM provisioned to all VMs (in GB)
# qm list | awk '{s+=$4}END{print s/1024}'
do not make a confusion about RAM actually allocated to running VMs, which should be smaller than provisioned RAM
also take care that KSM will reduce used RAM when you have similar VMs so that RAM can be "deduplicated"
and notice that I did not take CTXs into consideration, only VMs