Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Query hierarchically related data in Canvas App.

I have created self-referential one-to-many (1:N) relationship for CDM Task table, in the relationship definition the Hierarchical option is set to Yes.

In the documentation the process to query data as a hierarchy is explained for Model Driven App, I am wondering how can I show the same hierarchy in Canvas App?


Task 1

    Task 2

        Task 5

            Task 6

            Task 7

                Task 10

                     Task 11


        Task 4

    Task 8





NOTE: I want to go N levels deep and show all records under a selected record.

Super User
Super User

Hi @Usmannb ,


Please try the below link.

Relate records in Many-to-Many relationships | Microsoft Power Apps

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

My Blog: Dynamics 365 Key Topics –
My Youtube Channel :




Super User
Super User

Hello @Usmannb,


Hope you are doing good.


For 1:N Relationship and if you want to User Hierarchy, we can use Gallery Within Gallery so for a Parent Record it will Auto Show the Child Record.


1. Create a Parent Gallery (Name it as ParentGallery)--> On Click of Parent Gallery Navigate to Another Form

2. Load Child Parent(Name it as ChildLevel1Gallery) Gallery (ParentGallery.selected)

      a. Here in side a Gallery Create a Child Gallery (Gallery Inside Gallery)

      b. Set the Child Gallery (Name it as ChildLevel2Gallery) and Filter it as (ChildLevel1Gallery.Selected)


Thats it 🙂


You can find a Reference link here too :



Please mark as Answer if it is helpful and provide Kudos

Subscribe :
Blog :

Helper II
Helper II

Hi @Usmannb 


Please see my blog post below that demos how to easily descend through multiple tables to view descendants using the ForAll function



Dataverse Relations. Identifying Children, Grandchildren & Great-Grandchildren

Hello @DeviKrishna 

Thanks for your help but I am not looking to relate the records but to actually query the related records in hierarchy. 

Hello @rampprakash 

Thanks for the solution but it is not suitable to show N-levels of related records.

Hi @ChrisHarper 

Very well written blog but my Database structure is different then yours. I am looking for a solution to query "Hierarchical" Dataverse relationship. 

Helper II
Helper II

Hi @Usmannb 


The principle is the same whether it is seperate tables or self-joins in a single table hierarchy


To present the results exactly as you require is challenging.  Embedded flexible height galleries would be an ideal approach as you could click and expand to show the hierarchy structure, but unfortunately they can only go down 2 levels

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (4,111)