To get the number of vCPU for all the VMs in a resourcepool, you could do
Get-View $rp.VM | Measure-Object -Property {$_.Summary.Config.numCPU} -Sum | Select -ExpandProperty Sum
The memory figures are given in bytes, so you can divide by 1GB.
And with the Round function you can make the number more readable.
Something like this
$row."Memory Total Capacity" = [Math]::Round($rp.Runtime.Memory.MaxUsage/1GB)
or
$row."Memory Total Capacity" = [Math]::Round(($rp.Runtime.Memory.MaxUsage/1GB),2)
I had some further looks at the datastore metrics but I can't see why it would not be working.