web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter a gallery by us...
Power Apps
Unanswered

Filter a gallery by using another table with lookup

(0) ShareShare
ReportReport
Posted on by 13

Hello everyone,

This is the first time I have posted on Power Apps Community, usually, I find my answers but I'm stuck.

 

I have two SharePoint lists

- MandatoryTraining

IDCourseTitleCourseDuration
1

Course1

60
2Course2120
3Course3130

 

- EmployeeMandatoryTraining

EmployeeEmailTrainingMandatoryTrainingID
Jone@bla.com1
jone@bla.com2
steve@bla.com1

 

MandatoryTrainingID is a lookup column.

 

what I'm trying to achieve is for example when Jone enter the app a gallery will show only the training that he has

 

Course1

60
Course2120

 

I tried the below formula, but I'm receiving an error "Power Apps can't convert this number to a record"

Filter([@MandatoryTrainings], ID  in Filter([@EmployeeMandatoryTraining],EmployeeEmailTraining.Value=User().Email).MandatoryTrainingID)
 
any suggestions?
Thank you in advance
 

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @msqmomani92 ,

    The structure should be like this (noting that MandatoryTrainingID is a Lookup column)

    AddColumns(
     Filter(
     EmployeeMandatoryTraining,
     EmployeeEmailTraining = User().Email
     ),
     CourseTitle,
     LookUp(
     MandatoryTraining,
     ID = MandatoryTrainingID.Value
     ).CourseTitle,
     CourseDuration,
     LookUp(
     MandatoryTraining,
     ID = MandatoryTrainingID.Value
     ).CourseDuration
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • msqmomani92 Profile Picture
    13 on at

    @WarrenBelz Thank you so much for the help,

    The formula seems to be working, however, the gallery shows records but with no info, Thisitem.CourseTitle doesn't work.

    also what if I want to retrieve all info, not only Course title and Course Duration, is that possible

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @msqmomani92 ,

    The code is based on what you posted and should work. You would be better making the MandatoryTrainingID field a number column rather than a Lookup, however the fact it does not error means it should work. You might check your data.

  • Verified answer
    msqmomani92 Profile Picture
    13 on at

    This one should do the trick:

    Filter(MandatoryTrainings,
        ID in ForAll(Filter(EmployeeMandatoryTraining, EmployeeEmailTraining.Value = User().Email).MandatoryTrainingID,MandatoryTrainingID.Value)
    )
  • Verified answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @msqmomani92 ,

    The code I provided should have worked based on what you posted. However if you want a bit of Delegation management here (using the newest records from MandatoryTrainings if the list is over your Data Row Limit or to simply mask the warning if under this)

    With(
     {
     _Employee:
     Filter(
     EmployeeMandatoryTraining, 
     EmployeeEmailTraining.Value = User().Email
     ),
     _Manditory:
     Sort(
     MandatoryTrainings,
     ID,
     SortOrder.Descenting
     )
     },
     Filter(
     _Mandatory,
     ID in _Employee.MandatoryTrainingID.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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard