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 / Why you cannot trust o...
Power Apps
Answered

Why you cannot trust on Last() and Max() that refer to Dataverse records?

(0) ShareShare
ReportReport
Posted on by 255

I cannot retrieve correct records with Last(Table) and Max(Table).Rownumber. Even if I refresh the the Dataverse source, my functions don't return right output but records that were submitted yesterday.

Categories:
  • VaidasG Profile Picture
    469 on at

    Hi @Finnair,

     

    Can this be linked with Data Row Limit?

    use CountRows() to check if you are retrieving all records

     

    Regards

    VaidasG

  • Finnair Profile Picture
    255 on at

    Thanks @VaidasG 

    but it's not about that since I have only 100 records. I assume it might be some refreshing issue?

     

    In Dataverse Table the very Last Rownumber column value is 510. But my Last().Rownumber keeps returning 505.

     

    Even if I refresh the Dataverse Connection, close and open the app, it doesn't work. But this all is in Preview Mode of Power Apps Studio. Update: The same issue is in the published App.

     

     

  • VaidasG Profile Picture
    469 on at

    @Finnair, do you interrogate your data directly in the data source, or first bring your data into a collection?

    My second trouble shooting step would be to bring data to a collection, get that sorted (by your required field), and only the try First, Last, etc...

     

    Hope this helps

    Regards

    VaidasG

  • Finnair Profile Picture
    255 on at

    This doesn't work for me since there will thousands of rows. This is really annoying;

    I have fields that should retrieve totals from the very last row, and the Last(Table).Rownumber has "stuck" to point "Real Last Rownumber" - 20!

  • Verified answer
    VaidasG Profile Picture
    469 on at

    hi @Finnair,

     

    Are you sorting your table before getting last element? Try

     

    Last(Sort(Table, Rownumber, Ascending)).Rownumber

     

    Hope this helps

    Regards
    VaidasG

    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • Finnair Profile Picture
    255 on at

    Ok, the key for me was to use First(), including Sort: Descending. So after all I managed to make it work, thanks @VaidasG 

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 337 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard