Hi Mtcoder,
Yes. We can create a DDG with complicated conditions in PowerShell by using the RecipientFilter parameter. Here are some articles for your reference:
New-DynamicDistributionGroup
Create Dynamic Distribution Groups Using Customized Filters
The parameter works both for Office 365 pre-upgrade and after-upgrade though the second article can be a bit old.
@Adadson,
Thanks for your help.
Best Regards,
Bruce Zhou