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 / Want to use MAX not LAST
Power Apps
Unanswered

Want to use MAX not LAST

(0) ShareShare
ReportReport
Posted on by 55

In a form for viewing or entering records to an Excel sheet, I have successfully used the following for adding a new record, adding 1 to the EmployeeID of the last record:

If(EditForm1.Mode=FormMode.New, Last(LikeVideo).EmployeeID+1, ThisItem.EmployeeID)

But since the last record may not be contain the max value in that field, I decided to use MAX function.  I tried all of the following, with no success:

If(EditForm1.Mode=FormMode.New, Max(LikeVideo.EmployeeID)+1, ThisItem.EmployeeID)

If(EditForm1.Mode=FormMode.New, Max(EmployeeID)+1, ThisItem.EmployeeID)

I even tried (which I rightly did not think would work):

If(EditForm1.Mode=FormMode.New, Max(LikeVideo).EmployeeID+1, ThisItem.EmployeeID)

 

Max seems to be a valid function, but I am out of ideas.  Help!  I'm sure it is simple, but as we all know, everything in computers is easy, but often not intuitive. 🙂 

Categories:
I have the same question (0)
  • BCLS776 Profile Picture
    8,994 Moderator on at

    Try using Sort on the table to ensure your IDs are in order, then use First or Last as appropriate to pick the one you want.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @WillBeeSea 

    I suggest using First(Sort(LikeVideo,EmployeeID,Descending)).EmployeeID+1.  Make sure that EmployeeID is a number type column. Max() and Last() are not delegatable, meaning that once you exceed the maximum number of items (500 default, 2000 maximum), the result will not be correct.

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

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 494

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
11manish Profile Picture

11manish 323

Last 30 days Overall leaderboard