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 / Last() not working pro...
Power Apps
Unanswered

Last() not working properly

(0) ShareShare
ReportReport
Posted on by 65

Function

 

Last(SharepointList).Title

 

Set as "Text" property in label, returns not last created but random title. This only occurs on one app, another app with the same fucntions works ok (at least for now).

 

Any ideas why? 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,560 Most Valuable Professional on at

    How many items are in the SharePoint list and how is it sorted?

  • nottheOther Profile Picture
    65 on at

    Item counts as 1 row? Or in 1 row every column counts as 1 item?

  • Pstork1 Profile Picture
    69,560 Most Valuable Professional on at

    Each item is a single row.

  • nottheOther Profile Picture
    65 on at

    In app when it occurs last ID is 42, but function show last as 41 in developer mode. For end-user title/id is random. Another app where everything is ok there are more items.
    On Sharepoint list "edit current view" sorting on both lists is set up to "Sort by ID"

  • nottheOther Profile Picture
    65 on at

    Anyone?

  • Pstork1 Profile Picture
    69,560 Most Valuable Professional on at

    Sorry, you'll need to provide a lot more information.  based on what you've provided so far it looks like the coding is correct.  Not sure why its not working as expected.  Try adding a SortByColumn() based on ID to the data source declaration to make sure its sorted by ID when you ask for Last.  Like this

    Last(SortByColumn(datasource,ID)).Title
  • Chris_NJ Profile Picture
    2 on at

    I think I have the same issue.

    In my case, SharePoint list was created with each item having 5 columns, and the first column is a sequential ID number. I developed the app with a small data set (items 131-137), and Last(SharePointList).Column1 would return 137. Since then, to complete the data table, I added previous data in reverse order (131 down to 100), and sorted the list in SharePoint, low to high. My aim is to have the app automatically increment Column 1 when adding a new item.

     

    In the editing environment, Last(SharePointList).Column1 still returns 137, the biggest number. When uploaded and pubished to Teams, Last(SharePointList).Column1  returns 100. I'm not sure what the disconnect is.

     

    The editing environment tells me that Sort and SortByColumn are not supported for SharePoint lists.

     

    Any way to get the Teams installation of the app to see the sort used on the Sharepoint List?

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 316 Most Valuable Professional

#2
11manish Profile Picture

11manish 242

#3
Valantis Profile Picture

Valantis 198

Last 30 days Overall leaderboard