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 / Collecting from multip...
Power Apps
Unanswered

Collecting from multiple tables, determine the newest created on date to populate a gallery

(1) ShareShare
ReportReport
Posted on by 15
I have several tables for different types of engagements:
Attendance
'Dress Code'
'Reasonable Suspicion'
'General Feedback'
etc.

Every engagement table has a lookup column called 'Associate ID'.
These lookup columns all point to the 'Associate Info' table with the Primary Column of 'Associate ID'.

I have an Associates gallery and I want it to populate in the following order:
Associates with zero engagements first,
Associates with the oldest engagements next,
Associates with the most recent engagements last.

To do that, I want to use the 'Created on' system column.

On my HomeScreen in the OnVisible property I've set up something like this:
ClearCollect (AllEngagements, Attendance);
Collect (AllEngagements, 'Dress Code');
Collect (AllEngagements, 'Reasonable Suspicion');
Collect (AllEngagements, 'General Feedback');

And that's as far as I'm able to get.  Copilot isn't any help, and I've tried using ChatGPT, but any solution I find stumbles over the fact that the Associate ID field is a lookup to the Associate Info field and I just can't figure out what I should do next.

The spoken idea is this:

To populate the Associates Gallery,
    Find all records in AllEngagements that match the Associate ID in the Associate Infos gallery.
    Determine which record is the most recent.
    Extract the Created On date from that determination
    Populate the Associate Gallery in the following order:
           Associates with No engagement records - Populate first
           Associates with the Oldest engagement records - Next
           Associates with the Newest engagement records - Last

Finally, in the Associate Gallery, those with no engagements will have a light blue border, those with the most recent engagement between 0 and 7 days old will have a green border, those with the most recent engagement between 8 and 14 days old will have an orange border, and those associates with the most recent engagement of 15 days or more will have a red border.

The whole thing is a part of our new Engagement initiative to ensure that all of our associates are being engaged at least once every 2 weeks as a part of an hr/culture initiative.
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    152,841 Most Valuable Professional on at
    Collecting from multiple tables, determine the newest created on date to populate a gallery
    Your sort should be something like this
    Sort(
        AddColumns(
            AddColumns(
                AllEngagements,
                Engage,
                LookUp(
                    'Associate Info' As _Info,
                    _Info.'Associate ID' = 'Associate ID'
                ).YourEngagementColumn
            ),
            SortCol,   
            If(
                IsBlank(Engage),
                Date(1970,1,1),
                Created
            )
        ),
        SortCol
    )
    If you post the code you have attempted on the rest of it, I can have a look at it for you.
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • WarrenBelz Profile Picture
    152,841 Most Valuable Professional on at
    Collecting from multiple tables, determine the newest created on date to populate a gallery
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   

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