My Memberships web query displays the Active Directory groups for which a user is a member. My Memberships web query is included in the built-in My Organization container.
My Memberships web query settings
My Memberships web query has common settings with AD Users web query. For the information about My Memberships web query settings, please refer to the following article:
Settings specific to My Memberships web query
Specify which groups to display:
The default setting is All groups for which a user is a member.
Other Query Settings
Usually, rules use query criteria to limit the query search scope. It improves the performance of the executed rule.
Due to PowerShell limitations, it is not possible to use calculated expressions in query criteria. That is the point where initialization script can help. You can initialize a global variable in this setting and then use it in query criteria.
Important: To use a variable, declared in initialization script, in the query scope, it must be global: $global:<variable name>.