Announcements
I have a SP List of Vehicles where we track mileage. I want to have a gallery that lists the highest mileage value identified for each vehicle in out fleet. What would the Filter/Sort syntax be?
VehInsp is the SP List
VehNo.Value is the identifies the Vehicle ID
CurrentMileage would hold the value of the highest mileage
So do you want to just sort the mileage in the gallery by highest to lowest if so it would be:
Sort(VehInsp,CurrentMileage,Descending)the opposite would be:
Sort(VehInsp,CurrentMileage,Ascending)
Hello @AJ_Z Thanks for the response. I want the gallery to display each vehicle with the highest mileage value associated with that Vehicle.
As an example, there are 25 records for Vehicle 1. I would like to display the record for Vehicle 1 that contains the highest mileage value. The same would be true for Vehicle 2, 3, 4, etc.
Okay I think I understand now apologies so you want something like this:
DropColumns( AddColumns( GroupBy( AddColumns( 'Power App Test', "temp", testchoices.Value ), "temp", "grouped" ), "Mileage", Max( grouped, testnumber ) ), "grouped" )
the above works i have tested it my end
Hi @RJF61, you could do this by using the code below in you Items property of your gallery.The code below will loop through the unique vehNo's of your list and retrieve the record with the highest mileage for each.
With( { VehNoList: Distinct( VehInsp, VehNo.Value ) }, ForAll( VehNoList As Main, First( Sort( Filter( VehInsp, Main.Result = VehNo.Value ), mileage, Descending ) ) ) )
If this solves your question, would you be so kind as to accept it as a solution.Thanks!
Hey @RJF61 , Just checking in, did my solution work for you if so please accept it as a solution.
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 394 Super User 2026 Season 2
Mohsin Ali 328
WarrenBelz 324 Most Valuable Professional