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 / Recursive table in a S...
Power Apps
Suggested Answer

Recursive table in a SharePoint List

(0) ShareShare
ReportReport
Posted on by 1,004

Hello everyone,

I have a recursive table in a SharePoint List that contains the following columns:

ID

ParentId

Libelle

(as shown in the screenshot).

 

Now, I want to apply filters to retrieve, for example, only the items whose root parent has ID = 2.

How can this be done?

Thank you.

I have the same question (0)
  • Suggested answer
    Assisted by AI
    wolenberg_ Profile Picture
    1,051 Moderator on at
    Hello @gikido,

    You’re working with a hierarchical structure, where each item may have a parent, grandparent, etc. To find all items under ParentalID = 2, you need to trace each item's ancestry up to its top-level parent.
    Unfortunately, Power Apps and SharePoint don’t support true recursion out of the box but you can work around it.
     
    Option 1: Preprocess the hierarchy
    If possible, add a column to your SharePoint list called `ParentalID`, and populate it manually or via Power Automate. This column would store the top-level parent ID for each item. Then you can easily filter like:
    Filter(YourList, ParentalID = 2)
    
     
    Option 2: Use nested collections in Power Apps
    If you can’t modify the list, you can build a recursive lookup in Power Apps using `With()` and `LookUp()` to trace each item's lineage. For example:
    With(
        { rootItem: LookUp(YourList, ID = 2) },
        Filter(
            YourList,
            IsDescendantOf(ID, rootItem.ID)
        )
    )

    You’d need to define `IsDescendantOf()` as a custom function using nested `LookUp()` calls — but this gets complex fast and may hit delegation limits.
     
    Option 3: Use Power Automate
    Create a flow that:
    1. Starts from ParentalID = 2  
    2. Recursively finds all children  
    3. Returns the full list to Power Apps as a collection
    This avoids delegation issues and gives you full control over the hierarchy.
     
     
    Bottom line
    For performance and simplicity, adding a `ParentalID` column is the best long-term solution. If you need help building the Power Automate flow or writing the recursive logic.
  • gikido Profile Picture
    1,004 on at
    Thank you for your reply 
    I found the same solution in ChatGPT, but I would like another suggestion
     

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 342 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard