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 / I want to use LookUp t...
Power Apps
Unanswered

I want to use LookUp to return the most recent record in a collection

(0) ShareShare
ReportReport
Posted on by 34

I am trying to use LookUp to return the most recent record in a collection.  What I have just now is:

 

If(
 TimeValue(
 LookUp(colTimeEntryWeek, Date_ = datDateSTE.SelectedDate, Finish_Time)) > TimeValue(drpStartTimeSTE1.Selected.Value & ":" & drpStartTimeSTE2.Selected.Value), true)

 

This is a formula to show / hide a label to say If Date in collection matches date input in datDateSTE field then return the finish time.  If the time input in Start time boxes is after this Finish time then make it visible.  It works fine with only one record in the collection but the issue is when I have more than one record with that date it gets confused on the return value and doesn't base it on the most recent Finish time.

 

If you need any more info let me know.  Thanks.

Categories:
I have the same question (0)
  • Rusk Profile Picture
    1,369 Super User 2024 Season 1 on at

    Hi @CRam3b92 

     

    Assuming that "Finish_Time" is the column that has your date / time info, try this:

    First(Sort(colTimeEntryWeek, Finish_Time, Descending))
  • CRam3b92 Profile Picture
    34 on at

    @Rusk 

    Hi - thanks for your reply.  Finish_Time is a separate time column in the collection.

    I can see the idea behind doing this but just wondering the best place to put it?  Should it be nested inside my original formula or on a separate control?  I would have thought nested inside my original formula so the returned Finish_Time is the most recent record.

  • Rusk Profile Picture
    1,369 Super User 2024 Season 1 on at

    I think to incorporate that in your current formula, you could use something like this:

    If(
    TimeValue(
    First(
    SortByColumns(
    Filter(colTimeEntryWeek, Date_ = datDateSTE.SelectedDate), "Finish_Time", Descending
    )
    ).Finish_Time
    ) > TimeValue(drpStartTimeSTE1.Selected.Value & ":" & drpStartTimeSTE2.Selected.Value), true
    )

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 510

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 281

Last 30 days Overall leaderboard