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 / Filtering Custom many ...
Power Apps
Unanswered

Filtering Custom many to many tables with intermediary table

(0) ShareShare
ReportReport
Posted on by 125

Hi,

 

I am trying to filter tables with lots of  a 'many to many' relationship that has a intermediary.

 

I have a Student (1) ---->(Many) Student_Skills  (Many)----> (1)Skills_Name

 

 

I want to be able to filter students by a chosen skill . e.g. find me all the student whose skill is dancing .

In SQL I would use either join or nested select statements

e.g.

select student name

from student where id in (Select studentId from student_skills where skillsId IN (Select id from skill_name where skillName = "dancing")) 

 

I have tried nested filters but it doesn't work 😞  Any help much appreciated...just starting out with dataverse and power apps...the idea is to filter a gallery in a canvas app

Thanks

I have the same question (0)
  • a33ik Profile Picture
    3,306 Most Valuable Professional on at

    Hello Michelle,

    I believe you can use Dataverse's Advanced Find to build the query you need - https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/basics/save-advanced-find-search?view=op-9-1

    Once the query gives you the data you need you can export FetchXml and use it in your Canvas App.

  • Ram Prakash Duraisamy Profile Picture
    5,593 Super User 2025 Season 2 on at

    Hello @MichelleH,

     

    That was Awesome Query, Could you please let me know you want to Filter a Lookup or Filter a Subgrid, so that i can help u the same.

     

    Note:

     

    As per your SQL Statement we can do below operations to Achieve the same

     

    1. (Select id from skill_name where skillName = "dancing") --> Odata and Filter it and Store it in Array

    2. Select studentId from student_skills where skillsId --> Pass the 1 (Filtered Array here and Filter it)

    3. select student name from student where id in 2 --> Pass the 2nd Filter Value

     

    We can achive it OData Call, 

     

    Need a Clarity weather its look up or Subgrid.

     

     

    Please mark as Answer if it is helpful and provide Kudos


    Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
    Blog : https://microsoftcrmtechie.blogspot.com

  • MH-02091453-0 Profile Picture
    125 on at

    Hi,

     

    i am not sure if I understand the idea of advanced find and using it in the canvas app...is this dynamic?  can I use the advanced find and then the user chooses the skills they want to filter by? 

     

    From what  I understand I can use advanced find to find create that particular view but as I have over 300 skill and then have other tables I need to link to with  courses, so for example find students who can dance and study music, if I use advanced find is there any way of using dropdowns or user input to filter the table in the canvas app? There are too many combination for me to pre-create views for each situation. If you understand I want a series of dropdowns that allow the user to select?  I feel i need some filter and look-up commands associated with dropdown input that can dynamically filter the view

  • MH-02091453-0 Profile Picture
    125 on at

    Hi,

     

    Thanks for your reply.

     

    So there are 3 tables, one student( 1- many), one student skills and(many to one) one skill names.  The idea is that I need to display all the students with a certain skills/ skills, so the user would select filters from several dropdowns and pick which skill they want to filter, so there are two lookups in the intermediary student skills table, one that references the studentgui and the other the skill name guid.  Not too sure how i store the odata feed in the canvas app as an array?  Do you have any references to how to do that?

  • a33ik Profile Picture
    3,306 Most Valuable Professional on at

    What I wanted to suggest is to use Advanced Find to build the FetchXml query that you will be able to use to filter the data based on the skills selected.

  • MH-02091453-0 Profile Picture
    125 on at

    Hi,

     

    Ah ok so if I understand correctly i will basically join all the tables (and create one big table) I want in the fetchxml and then I can create a view from that which I use in my canvas app and then filter that big joined table?  Do you know any good links to help with fetchxml...sorry I am really new to all this, used to just using sql.

     

    Thanks so much for your help.

  • a33ik Profile Picture
    3,306 Most Valuable Professional on at

    You can try this website - http://www.sql2fetchxml.com/

  • v-xiaochen-msft Profile Picture
    on at

    Hi @MichelleH ,

     

    I did a test for you.

    vxiaochenmsft_0-1641265988897.png

    vxiaochenmsft_1-1641266000901.png

    vxiaochenmsft_2-1641266014309.png

    vxiaochenmsft_3-1641266023961.png

    vxiaochenmsft_4-1641266036733.png

    ForAll(Filter(TestL19S,LookUp_TestL20.Name=ComboBox1.Selected.Name),LookUp_TestL18.Name)

     

    Best Regards,

    Wearsky

     

  • MH-02091453-0 Profile Picture
    125 on at

    That is great thanks. However, I wanted to stucture it in the in way as in the sql statement as then i want to be able to also filter another custom many to many relationship, so I would also have student (1-many)---> student_enrollment --->(many-1) course_name.  So then I need to start from the student table if you understand so I would be able to check the studentName that is in both the skillintermediary table and the cenrollments intermediary table, so essentially:

     

    studentname from studenttable, where studentId in (studentid from student_skills table where skillName = 'dancing') and student id in (studentname from student_enrollments where coursename = 'Music)

     

    So i need to start from the tsudent table so then I can then reach other tables with the courseName in and also filter on those!

     

    Thanks in advance for any help and time.

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard