PowerShell and it's objects are awesome ... until they aren't.
One issue I face is that I use PowerShell to manage things on Office 365 / Azure AD that I can't do through the web interface. This is mostly good, except when it's not.
An example, if you're running something like Get-MailboxFolderStatistics on a local Exchange server, the statistics you get back are proper objects, and you can do things like sort them by size.
If, however, your run this against Office 365, you get output back that looks the same, except it's serialised as xml, sent down the line, and then deserialised for display. There's no option to tell it to return sizes in bytes, because you don't need to because it's an object and you can display it however you want. It then returns human-readable sizes (e.g. 12.3 GB, 486 MB etc) and now you can't sort it because it comes back down the line as text. If you want mailbox folders, on Office 365, sorted by size, you then need to grab this text, and parse it to turn it back into bytes, sort it, and then parse it again to turn it back into human readable text.
So you then need to do something like:
Get-MailboxFolderStatistics username | sort-object @{ Expression = {$tmp = $_.FolderSize -replace ".*\((.+) bytes\)","`$1"; [int]$foldersize = $tmp -replace ",",""; $foldersize }; Ascending=$false } | ft Identity,FolderSize