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 / Creating A Collection ...
Power Apps
Answered

Creating A Collection From another Collection

(0) ShareShare
ReportReport
Posted on by 8

I have a collection with 3 columns, Location, Date and Value. I need to create another collection based on the existing collection, but if the date, at a location is within 3 days of a previous entry at the same location, I don't want to add it to the new collection. 

Example: 

 

Collection1:    Location              Date          Value

                      New York       12/19/2020        5

                      New York       12/23/2020        3

                      New York       12/25/2020        2

                           L.A             12/19/2020       3

                           L.A             12/21/2020       3

                           L.A             12/27/2020       5

 

Desired Collection2:     Location             Date           Value

                                    New York       12/19/2020        5

                                    New York       12/23/2020        3

                                         L.A             12/19/2020       3

                                         L.A             12/27/2020       5

As you can see, the entries from the first collection, that had an entry at the same location within 3 days prior, werent added to the second collection. 

Is this possible, if so how can it be achieved?

 

Thanks

   

Categories:
I have the same question (0)
  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @mrizz ,

     

    I think something like this should work but I'm not sure it's the best..

     

     

    Clear(Collection2);
    ForAll(Collection1,
     If(IsBlank(LookUp(Collection2, Location in Collection1[@Location] && Abs(DateDiff(Date,Collection1[@Date])<3))),
    		Collect(Collection2,ThisRecord))
    		)

     

     

     

    Regards,

    Akram

     

    ------------------------------------------------------------------------------

    If this helped you, please consider giving it kudos and accept it as a solution. Thanks 

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 413

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
timl Profile Picture

timl 315 Super User 2026 Season 1

Last 30 days Overall leaderboard