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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to automatically s...
Power Apps
Unanswered

How to automatically split a collection into subcollections based on ID and name them thereafter

(0) ShareShare
ReportReport
Posted on by

Hello there,

 

I have a collection with an ID number and I want to split this collection into multiple sub-collections based on the ID number.

I also want to name the sub-collections after the ID number.

Does anyone have a solution with a loop?

 

The manual approach would be:

ClearCollect(Col_ID_number_1, Filter(Col_TOTAL, ID_number = "ID_number_1"));

ClearCollect(Col_ID_number_2, Filter(Col_TOTAL, ID_number = "ID_number_2"));

.

.

 

I have tried the following loop (but it causes error messages..):

ForAll(Col_TOTAL, ClearCollect(Concatenate("Col_", ID_number), Filter(Col_TOTAL, ID_number = ThisRecord.ID_number)))

 

Thanks in advance for suggestions!

Categories:
  • QuentinDURIEZ Profile Picture
    577 Moderator on at

    Hi,

    You can't create collections on the go, collections need to be named explicitly.

    You can use the formula GroupBy

    ClearCollect(_col,
     GroupBy(Col_TOTAL , 'ID_number', 'list')
    )

    In result, you'll get a collection with, for each row, your ID_number and a table filtered by this number :

    ID_numberlist
    1Filter(Col_TOTAL, ID_number = 1)
    2Filter(Col_TOTAL, ID_number = 2)
    ......

     

    After that, if you want to have specificaly the list for ID_number=1, juste do

     

    LookUp(_col; ID_number=1).list


    Regards,

  • Selvarokith_B Profile Picture
    82 on at

    Hi @Marvin5 ,

     

    Please try this 

    ClearCollect(
            AllData,
                Filter(
                    D0_Lead_Data_Form,
                    Item_ID <= 2000
                ),
              
                Filter(
                    D0_Lead_Data_Form,
                    Item_ID > 2000 && Item_ID <= 4000
                ),
               
                Filter(
                    D0_Lead_Data_Form,
                    Item_ID > 4000 && Item_ID <= 6000)

    )

     

    Thanks,

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard