I have to admit I'm running out of ideas on what goes wrong here.
I tested the same script with the data you provided earlier, and it works perfectly.
One more shot, can you also try the following?
$CMDBInfo=Import-CSV.\DS-Tag.csv-Delimiter';'|
Sort-Object-PropertyName,Location-Unique
Write-Host"There are $($CMDBInfo.Count) entries"
$TagCatNames=$cmdbinfo|Get-Member|Where {$_.MemberType -eq"NoteProperty"} |Select-ExpandName
Foreach ($Namein ($TagCatNames|Where {$_-ne"Name"})){
Write-Host"Category : $Name"
$UniqueTags=$cmdbinfo|Select-expand$Name|Get-Unique
Foreach ($Tagin$UniqueTags){
$cmdbinfo|Where {$_.($Name) -eq$Tag} |Foreach {
Write-Host"Category: $Name - Tag : $Tag - Entity: $($_.Name)"
}
}
}