'How to filter data in Get-MailboxStatistics

I'm quite new in Powershell. I am trying to filter the result of the cmdlet Get-MailboxStatics, because i wanna know statistics on a subset of items in the mailbox, precisely i'd like to know the number of items received before a certain date and after that the dimension of them all aggregated.

i tried with this:

$stats = Get-MailboxStatistics -identity $username | where {$_.EndDate -eq $age}

But this attempt doesn't work and give me an empty result.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source