Notifications
Announcements
Hopefully a quick solve here, but I am trying to find the max value (actually a date) stored in labels in a gallery.
Using the following, the return is always "0""
Max( Gallery1_3.AllItems, Label2_12.Text )
@tlevine
First(Sort(Gallery.AllItems, datefield, Descending).datefield
hi @Drrickryp - i actually dont want to sort the gallery, im trying to find the actual max value of the field. hope that helps to clarify
The formula @Drrickryp provided will give you the max date value. You cannot use the Max or Min functions on a date like you were. The trick is to just sort in your formula and take either the first or last depending on if you want max or min.
The formula is not going to sort your gallery, just give you the max value.
makes sense - i wasnt thinking about the max or min applying to numbers. i will give this a try an then accept as a solution
This may/may not be relevant but I believe this will only work for the rows that are currently showing in the gallery.
If the items property of the gallery is delegable, the gallery will load records in batches of 100 (the next batch being fetched as you scroll to the end of the current batch), so if you have a delegable source for the gallery and more than 100 rows and you haven't physically scrolled to the end, you will only get the Max of those 100 records currently in the gallery, not all records in the source.
I've seen folk get caught out with this when building there App against a small set of test data and then find that it won't scale to larger datasets.
@PaulD1
Yes, this is a true statement. If the gallery is paging (delegable simple formula) then referencing AllItems will only ever contain all the records *currently* in the gallery table.
Considerations everywhere to always be make in the design! 😉
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.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 739 Most Valuable Professional
Michael E. Gernaey 343 Super User 2025 Season 2
Power Platform 1919 268