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 / sorting a lookup column
Power Apps
Answered

sorting a lookup column

(0) ShareShare
ReportReport
Posted on by 5

So I have a gallery that populates correctly.  Within the gallery I have a column for “STATUS” … that column does a lookup to another table … and gets a last scheduled date. I want to compare that date against today’s date to return an “ACTIVE” or “INACTIVE”.

 

If (

   LookUp(‘lookuptable’, CUST_NUM = ThisItem.CUST_NUM && LAST_UPDATE_LOC = ThisItem.LAST_UPDATE_LOC, SCHEDULE_DATE) >= Today()

   "ACTIVE",

   "INACTVE"

   )

 

The lookup might have more than one row to return, but will only return one row.   How can I sort the SCHEDULE_DATE to return the most recent?  Currently it is pulling just the customer's first date.

Tried many ways without success.  Even tried to put ‘ && SCHEDULE_DATE >= Today()’ in the formula  … but that didn’t work either.

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,566 Most Valuable Professional on at

    Hi @maschrag ,

    The latest date should work with this

    If(
     LookUp(
     Sort(
     ‘lookuptable’,
     SCHEDULE_DATE,
     Descending
     ),
     CUST_NUM = ThisItem.CUST_NUM && 
     LAST_UPDATE_LOC = ThisItem.LAST_UPDATE_LOC
     ).SCHEDULE_DATE >= Today(),
     "ACTIVE",
     "INACTVE"
    )

     

    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.

    Visit my blog Practical Power Apps

  • maschrag Profile Picture
    5 on at

    Thanks for the solutions!!!   Got another question if I may .... 

    Since I am using an IF function ... before the lookup completes ... the default values is false ... so INACTIVE is initially displayed ... than flips to ACTIVE mid load.   Is there a way to not display the status until the entire lookup completes?  So the end user doesn't see INACTIVE and than a flip to ACTIVE before their eyes?

  • WarrenBelz Profile Picture
    156,566 Most Valuable Professional on at

    Hi @maschrag ,

    Not unless you want to hide the field on a timer and display it a period after you have change the affected field.

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

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard