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 / Sort, Filter, and Dist...
Power Apps
Answered

Sort, Filter, and Distinct on Gallery

(0) ShareShare
ReportReport
Posted on by 99

Anyone know how I could add a filter by user input in this gallery items property?

 

This is my current code:

Sort(Distinct('Safety Training', 'Employee Name'), Result, Ascending)

 

Thank you!

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,585 Most Valuable Professional on at

    Hi @aebara ,

    You did not say what the user was using to do this, but it would go in here

    Sort(
     Distinct(
     Filter(
     'Safety Training', 
     FieldName = UserInput
     ),
     'Employee Name'
     ), 
     Result
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • aebara Profile Picture
    99 on at

    Hi @WarrenBelz,

     

    Whoops, sorry!

     

    Currently, the user is being presented with a sorted, distinct-ized gallery. When they click an item in the gallery, it loads that info to a data table.

     

    I basically want to add a text_input box that will filter the gallery by employee name.

     

    Your code does work! Thank you 😊

     

    But now that I see it working, I have a new question...

     

    Is there a way to display sorted and distinct results in the gallery before a user sends an input? Currently, the gallery is blank until you type the majority of a name... I was hoping to just have the list displayed in alphabetical order, updating once you type in the textbox

    ^ Oops, fixed this. Had some sneaky text in the input_box ^

     

    Which brings me to one last inquiry... It seems I need to type the entire employee name for the filter function to work. For that reason, I think I would be better off with a search function, or startswith, rather than filter. Do you know how I could combine one of those functions with sort and distinct? I tried dropping them in place of the filter function, but of course that isn't good enough for PowerApps 🙃

    ^ Fixed as well

     

    Sort(
     Distinct(
     Filter(
     'Safety Training', StartsWith('Employee Name', TextInput1.Text)
     ),
     'Employee Name'
     ), 
     Result
    )

     

    Thanks again @WarrenBelz!

  • CW Profile Picture
    1,044 on at

    I used this in my scenario and worked great for me! Now I feel like a rock star or high end software engineer 😅

     

    If this is useful to anyone, this how I used it:

     

    Sort(
     Distinct(
     Filter('Part Designations','Tune:SetListtxt'.Value = "Yes"
     ),
     ThisRecord.Tune.Value
     ),
     Result
    )

     

    although I see a delegation warning at the 'Tune:SetListtxt'.Value = area.

     

    Thanks Warren.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 404

#2
timl Profile Picture

timl 344 Super User 2026 Season 1

#3
WarrenBelz Profile Picture

WarrenBelz 320 Most Valuable Professional

Last 30 days Overall leaderboard