Skip to main content
Community site session details

Community site session details

Session Id : h1UGWGP26DMjMM9HYKI1kE
Power Apps - Building Power Apps
Answered

How to filter a lookup list based on which lookup is calling it?

Like (0) ShareShare
ReportReport
Posted on 29 Mar 2023 21:06:41 by 86

Hi,

 

I wondering if someone could suggest a / the solution to this query I have regarding filtering a list based on which lookup is calling it?

 

Scenario:

I have a table of Employees, which stores their Name and a Job Title (a fixed choice field)

 

On a form for another table I have two fields I wish to set:

  • Project Manager (lookup)
  • Branch Manager (lookup)

 

When selecting it, I would like the lookup for Project Manager to display the records in the Employees table but only show those whose Job Title is Project Manager, so the user can only select ones for the correct job. Then the same principle for the other lookup, but using the Branch Manager job title.

 

Do I need to create two new lookup views, each with their specific filter applied, and set each lookup on the form to call the relevant lookup view? Or is there something more simple I'm missing?

 

Thanks

 

 

 

 

Categories:
  • jase Profile Picture
    86 on 30 Mar 2023 at 08:44:47
    Re: How to filter a lookup list based on which lookup is calling it?

    Thanks to both @CNT  and @rswain.

     

    For anyone else, as a conclusion I ended up creating two separate views on the Employees table; one filtering by 'Project Manager' and one filtering by 'Branch Manager'. Then I added the two lookups to my form; one pointing at the 'Project Manager' view and the other to the 'Branch Manager' view. Remember that you might need to force refresh your browser when trying it out to see the changes, as that caught me out to begin with!

     

    I have a follow up question about adding multiple people of the same job title but I'll ask that in a separate post.

     

    Thanks again.

     

  • Verified answer
    rswain Profile Picture
    173 on 30 Mar 2023 at 07:35:34
    Re: How to filter a lookup list based on which lookup is calling it?
    Yes, you can create two separate views for the Employee table and apply the necessary filters for each view.
    
    For the Project Manager lookup, you can create a view where the Job Title is filtered to show only "Project Manager". Then, set the lookup control's "Lookup field" property to the "Name" column of the Employee table, and the "Lookup data source" property to the view you created for the Project Managers.
    
    Similarly, you can create another view for the Branch Managers and set the lookup control's "Lookup data source" property to this view.
    
    When the user selects a value from the Project Manager lookup, the selected value will be the Name of the Employee, but only those employees whose Job Title is "Project Manager" will be displayed in the lookup control. The same applies to the Branch Manager lookup.
  • jase Profile Picture
    86 on 29 Mar 2023 at 21:39:45
    Re: How to filter a lookup list based on which lookup is calling it?

    Thanks for the reply @CNT . I’ve realised I left off a key piece of information previously, which is that I’m creating a model driven app rather than canvas.

     

    Is your solution still applicable?

  • CNT Profile Picture
    10,919 Super User 2024 Season 1 on 29 Mar 2023 at 21:27:57
    Re: How to filter a lookup list based on which lookup is calling it?

    @jase You can use Filter to get only the desired records. Assuming that you have a Dataverse table, the formula would be,

    Filter(Employees, 'Job Title' = Choices('Job Title').'Project Manager')

     

    Please remember to give a 👍 and accept my solution as it will help others in the future.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete