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 : KWE6uZCH3/1I4HzZF4Wpm+
Power Apps - Building Power Apps
Answered

Search a gallery for the earliest record, retrieve that date to be displayed on a text label

Like (0) ShareShare
ReportReport
Posted on 4 May 2021 21:17:41 by 24

I have a parent table (Milestones) with a child table (Activities). For the Milestone's Start date I want to write a function that finds the start date for the first activity of the Milestone. 

 

Here is my logic: 

 
  Lookup(Actvities, MilestoneID = selected_record.MilestoneID),
      SortByColumns(Activities, "DateStarted", Descending))

Kinda stuck. Thanks!



  • WarrenBelz Profile Picture
    148,896 Most Valuable Professional on 06 May 2021 at 21:26:55
    Re: Search a gallery for the earliest record, retrieve that date to be displayed on a text label

    Thanks,

    Dangers of free-typing code - I see that now.

  • dataguy33 Profile Picture
    24 on 06 May 2021 at 15:29:21
    Re: Search a gallery for the earliest record, retrieve that date to be displayed on a text label

    The only thing you missed was, the field that needed to be displayed in the lookup function. So:

     

    With(
    {
    wActive:
    Sort(
    Activities,
    DateStarted,
    Descending
    )
    },
    Lookup(
    wActive,
    MilestoneID = selected_record.MilestoneID, DateStarted
    )
    )

     

    Really useful though, thank you @WarrenBelz !

  • Verified answer
    WarrenBelz Profile Picture
    148,896 Most Valuable Professional on 05 May 2021 at 00:23:35
    Re: Search a gallery for the earliest record, retrieve that date to be displayed on a text label

    Hi @dataguy33 ,

    I am assuming here that selectedRecord.MilestoneID is a Variable matching the field MilestoneID in Activity. If so, try this

    With(
     {
     wActive:
     Sort(
     Activities,
     DateStarted,
     Descending
     )
     },
     Lookup(
     wActive, 
     MilestoneID = selected_record.MilestoneID
     )
    )

     

    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.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2