web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard