Like this
Get-VM|Group-Object-Property {$_.Folder.Id} |
Select@{N="Folder";E={
$folder=$_.Group[0].Folder
$path=$folder.Name
while($folder.Parent){
$folder=$folder.Parent
$path=$folder.Name+"/"+$path
}
$path
}},
@{N="NumCPU";E={$_.Group|Measure-Object-PropertyNumCpu-Sum|Select-ExpandPropertySum}},
@{N="MemoryGB";E={$_.Group|Measure-Object-PropertyMemoryGB-Sum|Select-ExpandPropertySum}} |
Export-CsvC:\report.csv-NoTypeInformation-use