
Hi @76716164,
You could try using the Content Search Web Part to crawl specific fields in the user profile for dynamic content rendering.
1.Create a term set,like Location or Department.
SharePoint admin center->More features->Term store
2.Add a user profile property to the existing set of properties and link it to the term set just created.
SharePoint admin center->More features->User profiles->Manage User Properties
3.Manage the User profile of the logged-in user, fill the newly created property.
SharePoint admin center->More features->User profiles->Manage User Profiles
4.Create a new content type with managed metadata field linked to the newly created term set.
5.Attach and display the newly created content type to the list.
6.The Content Search web part should display data that matches the newly created content type.
7.Switch to Advanced Mode. Added an additional filter to ensure that only items whose location/department matches the location/department in the current user's user profile properties are displayed. Set the crawled property to the current user's property.
For a concrete example you can check out this article: Filter a Content Search Webpart by a User Profile Property
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
===================
Update the answer=============
If you are using a modern page, you can try the Highlighted content web part. This web part has similar functionality to the Content query and Content search web part in the classic page.
The HCWP allows more advanced filtering and sorting by a Managed Property. Managed Properties are available to filter and sort in HCWPs either through the regular filter interface or via the more customizable KQL and CAML interfaces. The HCWP is a hybrid between CQWP and Search. At present, it should not be possible to use CAML to filter user attributes, so you can try to use KQL syntax to query managed metadata.
These two articles are about the documentation of HCWP and the basics of KQL: Advanced Highlighted Content Web Part ; KQL – The Basics
Combined with the crawled properties of the location/department mentioned in my answer above or a mapped managed property, filter it through the HCWP. Or specific examples can refer to the use of KQL in this post: Highlighted content web part filter crawled property based on user profile attribute.
If you're new to using managed properties in the Highlighted Content Web Part, take a look at this post for a concrete example,which covers a typical problem while using it.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.