cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CamCov
Helper II
Helper II

Filter out list items based on lookup column

I need to filter this datatableto only show items where the current users is set as the Sponsor, manager, or member for a project. 

 

Here is the formula I have so far that takes care of the sponsor and manager as these two columns are single select. 

 

Sort(Filter('Project Excellence', Sponsor.Email = User().Email, 'Project Manager'.Email = User().Email), 'Project ID', Ascending)

 

I need to add a logical test in the filter that looks through the project members column to see if the current user email matches any of the project members. However this column is a multi-select lookup column the structure is below:

 

Main list that references a secondary project members list:

CamCov_1-1651608126900.png

 

 

 

Secondary Project Members list:

CamCov_0-1651608057175.png

 

Example from the list:(Each member comma separated)

CamCov_2-1651608201434.png So if Shashi is in the project member column he should be able to see that item in the data table in the app and vica versa. 

 

I know this is a lot, and I know I have to use ForAll() somewhere, but alas no luck. I am having trouble pulling all the email addresses from the secondary list to see if if the current user matches.

 

Any help or advice is greatly appreciated!

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @CamCov ,

That is a normal lookup column - a small piece of advice (if you will take it) throw away those complex columns unless you need them for some reason and write everything back to Single Lines of Text - I have a blog on this - it will save you an enormous amount of unwanted complexity and grief. I have never found the need to use either People or Lookup columns.

So what I think you need here

With(
   {
      wList:
      Sort(
         Filter(
            'Project Excellence', 
	     Sponsor.Email = User().Email || 
	     'Project Manager'.Email = User().Email
         ), 
         'Project ID'
      )
   },
   Filter(
      wList,
      User().Email in 'Project Team Member'.Value
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @CamCov ,

If that is a Person field, the comma separation is only in the SharePoint display - I believe you need (note this is not Delegable)

Sort(
   Filter(
      'Project Excellence', 
      Sponsor.Email = User().Email || 
      'Project Manager'.Email = User().Email ||
      User().Email in 'Project Team Member'.DisplayName
   ), 
   'Project ID'
)

if you want it Delegable, this will work as long as the top filter returns records less than your limit

With(
   {
      wList:
      Sort(
         Filter(
            'Project Excellence', 
	     Sponsor.Email = User().Email || 
	     'Project Manager'.Email = User().Email
         ), 
         'Project ID'
      )
   },
   Filter(
      wList,
      User().Email in 'Project Team Member'.DisplayName
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hi Warren,

 

So DisplayName was not available for the 'Project Team Members' field only ID and Value. 

 

That lookup column "is" a person field but it looks at the Name field shown here:

CamCov_0-1651671685269.png

I couldn't get the lookup column to work properly without this name field. 

 

here is the Project Team Members column in the master list: 

CamCov_1-1651671773690.png

 

I feel like this is close! Thanks for your efforts so far!

 

WarrenBelz
Super User
Super User

@CamCov ,

I am confused  - 'Project Team Member' is a Person field and therefore will have a DisplayName. 'Project Members' is a Lookup column - you cannot lookup a Person field, so what is it looking up (it seems to be concatenated text) ?

Yes I believe I've confused myself too... 

Here are the formula(s) that set the Lookup Column in the master list, 'Project Excellence', to all of the items in the second list 'Project Vs Members' with the same title. 

CamCov_1-1651758434571.png

 

Here is the second list 'Project Vs Members' that has the Name column set to the DisplayName of the selection made in the Person Column(done above with Patch())

 

CamCov_0-1651757889881.png

 

The contents of the name column are then displayed in the master 'Project Excellence' list if they have the same title. (Multiple selections allowed)

CamCov_2-1651758938394.png

 

 

I hope that makes sense..

 

 

 

Hi @CamCov ,

That is a normal lookup column - a small piece of advice (if you will take it) throw away those complex columns unless you need them for some reason and write everything back to Single Lines of Text - I have a blog on this - it will save you an enormous amount of unwanted complexity and grief. I have never found the need to use either People or Lookup columns.

So what I think you need here

With(
   {
      wList:
      Sort(
         Filter(
            'Project Excellence', 
	     Sponsor.Email = User().Email || 
	     'Project Manager'.Email = User().Email
         ), 
         'Project ID'
      )
   },
   Filter(
      wList,
      User().Email in 'Project Team Member'.Value
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @CamCov ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hey Warren, 

 

Thanks for the follow up. 

 

I had to modify my list a little to make it easier on myself, (changing the name column to an email address) but yes your solution worked! Also your blog is awesome... Anyone reading this thread go give it a look!!!

 

https://www.practicalpowerapps.com/data/constructing-your-first-power-app-before-you-start/

 

Thanks again warren!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,385)