You could start out by setting the allmailbox variable to focus on just a specific OU, such as Sales, for example
$allmailbox=get-mailbox -OrganizationalUnit OUGroupName
or, if you want to use the Filter switch, you could try something like this:
$allmailbox=get-mailbox -Filter {Office -eq 'Finance'}
or -Filter {Department -eq 'Accounting'}
or -Filter {CustomAttribute15 -ne 'Exclusion'}