cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dataguy33
Frequent Visitor

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

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!



1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

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.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User III
Super User III

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.

View solution in original post

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 !

Thanks,

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

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (12,812)