If you want to identify the mailboxes that haven't been accessed and they are no longer in use in Exchange Online O365 from last 30 days, you can check by following the steps mentioned.
View the Number of Mailboxes that haven't Been Accessed from Last 30 Days in Exchange Online
- Open PowerShell with elevated privileges.
- Execute the following command.
The command without parameters queries the Mailboxes of the last 30 days.
Here are the optional parameters:
Get-StaleMailboxReport [-EndDate <DateTime>] [-ResultSize <Unlimited>] [-StartDate <DateTime>]