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 / Filter a Gallery Based...
Power Apps
Unanswered

Filter a Gallery Based on Dropdown and Last() Choice SP Column

(0) ShareShare
ReportReport
Posted on by

Hello! 

 

I have a SharePoint list that tracks checking in/out vehicles for my company. I'm trying to build a gallery that shows which vehicles are available to check out. 

 

Important SharePoint list structure considerations:

Sharepoint List name = Vehicle Tracker

Column Name in List = Vehicle ID Number, Identifier = IdentificationNumber, Type = Choice

Column Name in List = Vehicle Status, Identifier = EquipmentStatus, Type = Choice

 

My current formula for my gallery is:

Last(Filter('Vehicle Tracker', 'Vehicle Status'.Value=TextInput2.Text))

I have a TextInput field that is hidden and says "Checked In", and it shows a vehicle as it should, but the problem is that it's only showing the last vehicle that was checked in. I need it to show each vehicle that's available as "Checked In" so users can select it for Check Out. 

 

I hope this makes sense. Thank you ahead of time for your responses! 

Categories:
I have the same question (0)
  • Ash13 Profile Picture
    576 on at

    Hi @Applications 

    What are you trying to achieve by using the last() function? This will always return 1 row, the last row in the table you give it.

  • Applications Profile Picture
    on at

    I'm trying to use Last() to return the most recent record for each vehicle, since I have a running log of each vehicle's check in / check out. And then from there, filter the gallery to vehicles that are checked in

  • Ash13 Profile Picture
    576 on at

    I get you. I can't think of a good solution for your data structure without running into delegation limit issues.

     

    (This would have been something like 

    Filter(ForAll(Distinct('Vehicle Tracker'.'Vehicle ID Number','Vehicle ID Number'),Last(Filter('Vehicle Tracker','Vehicle ID Number'=ThisRecord.Value))),'Vehicle Status'.Value="Checked In")

     )

    Instead, I would recommend having separate sharepoint lists. One for the complete list of vehicles and their checked in/out status, then another for the logs. So when a vehicle is checked in or out, it patches both tables, changing the vehicle status of the existing row in your vehicles table, then adding a new row into your log table.

    For example, on a check in step (assuming you have a button in the gallery of vehicles):

    Patch('Vehicle List',ThisItem,{'Vehicle Status':{Value:"Checked In"}});
    
    Patch('Log List',Defaults('Log List'),{'Vehicle ID Number':ThisItem.'Vehicle ID Number','Vehicle Status':{Value:"Checked In"}})

     
    Then you can just filter your gallery with Items:

    Filter('Vehicle List', 'Vehicle Status'.Value=TextInput2.Text)


     I would also recommend using a dropdown instead of a text input for a user to choose the status of checked in or out.

     

    Hope this makes sense 🙂

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard