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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create collection filt...
Power Apps
Unanswered

Create collection filtered by date time field DESC for multiple collections

(0) ShareShare
ReportReport
Posted on by 102

I have an issue where I have an activity table , which now has 10,000 records .

At present I am creating multiple collections based on an AccountID code. 

So at present I can pull in on average 40 rows of activity per ID.

What I would like to do is have an additional sort by date/time field , so if the activity get's too large in the future , this will ensure that the latest activity would be added to the collections.

my date/time field is named field_5

This is my current working code , is there a way to add the sort by field_5 DESC to this

Concurrent(
ClearCollect(
activity_0,
Filter(
Activity_List,
AccountID >= 0 && AccountID < 50
)),
ClearCollect(
activity_1,
Filter(
Activity_List,
AccountID >= 50 && AccountID < 100
)),
ClearCollect(
activity_2,
Filter(
Activity_List,
AccountID >= 100 && AccountID < 150
)),
ClearCollect(
activity_3,
Filter(
Activity_List,
AccountID >= 150 && AccountID < 200
)),
ClearCollect(
activity_4,
Filter(
Activity_List,
AccountID >= 200 && AccountID < 250
)),
ClearCollect(
activity_5,
Filter(
Activity_List,
AccountID >= 250 && AccountID < 300
)),
ClearCollect(
activity_6,
Filter(
Activity_List,
AccountID >= 300 && AccountID < 350
)));

ClearCollect(activity,activity_0,activity_1,activity_2,activity_3,activity_4,activity_5,activity_6);

Clear(activity_0);Clear(activity_1);Clear(activity_2);Clear(activity_3);Clear(activity_4);Clear(activity_5);Clear(activity_6);

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    152,843 Most Valuable Professional on at
    Re: Create collection filtered by date time field DESC for multiple collections

    Hi @JD_26 ,

    You can do this

    ClearCollect(
     activity_0,
     Filter(
     Sort(
     Activity_List,
     DESC,
     Descending
     ),
     AccountID >= 0 && AccountID < 50
     )
    )

    but if all your records are in the newest 2,000, all you need to do is this

    ClearCollect(
     activity,
     Sort(
     Activity_List,
     DESC,
     Descending
     )
    )

     

    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

  • JD_26 Profile Picture
    102 on at
    Re: Create collection filtered by date time field DESC for multiple collections

    Thanks , where do I add field_5 in the formula please , this is the column I need to sort on , tried

    ClearCollect(
     activity,
     Sort(
     Activity_List,
     DESC,
     field_5
     )
    )

     replacing Descending with field_5 

  • JD_26 Profile Picture
    102 on at
    Re: Create collection filtered by date time field DESC for multiple collections

    my date field is named field_5 , how do I add to your code please , which is shown below

    ClearCollect(
     activity_0,
     Filter(
     Sort(
     Activity_List,
     DESC,
     Descending
     ),
     AccountID >= 0 && AccountID < 50
     )
    )
  • WarrenBelz Profile Picture
    152,843 Most Valuable Professional on at
    Re: Create collection filtered by date time field DESC for multiple collections

    @JD_26 ,

    Replace DESC with field_5

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 231 Super User 2025 Season 2

Last 30 days Overall leaderboard