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 / Using Distinct, Sort a...
Power Apps
Answered

Using Distinct, Sort and Filter to

(0) ShareShare
ReportReport
Posted on by 42

I am trying to load a Gallery items using somthing like this:

Distinct(Sort(Filter([DataSourc), column1=user().email), StartsWith(Column2, TextSearchBox.Text), Column2, Descending), Column2)

 

The idea is to filter the datasource by the user connected, and if the user type anything in the textbox, the list will be filter by.

After the complete items, the list need to be ssort by the column 2 descending and at the end, distinct the full list in case any repeated value.

 

All works but the StartsWith part.....

The list is not showing any record when I include the startswith function.

Categories:
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @aemiranda, 😊

     

    The StartsWith should be included as an additional parameter within the Filter function. I expect the issue to be related to the faulty parameter (& bracket) placement.

     

    Could you give the following structure a try:

     

    Distinct(
     Sort(
     Filter(
     Datasource, 
     //Added a comma after .Email & included StartsWith within the Filter function
     column1 = user().Email,
     StartsWith(Column2, TextSearchBox.Text)
     ), 
     Column2, 
     SortOrder.Descending
     ), 
     Column2
    )

     

    Should the issue remain - are you receiving a particular error & what datasource are you using?

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

  • aemiranda Profile Picture
    42 on at

    Hi Laura,

    I follow your advice and recommendation but still it remains the same behavior:

    The list is empty.... like it is only working if I write anything in the textbox.

    But I does not showing me the full list of items.

     

    The image showing the list of items have this core: 

    Distinct(Sort([@RamP], Entrega, SortOrder.Descending), Entrega)
     
    The image with blank gallery have this:
    Distinct(
        Sort(
            Filter(
                RAMP,
                StartsWith(Entrega, TextSearchBox1.Text)
            ),
            Entrega,
            SortOrder.Descending
        ),
        Entrega
    )
    WithoutTheStartsWithFilter.png
    WithTheStartsWithFilter.png
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @aemiranda,

     

    Thank you for the additional info!

     

    Based on the screenshots, I think your text input still has the 'Text Input' default value. In other words, your search box is not empty but your filter is rather searching for rows where Entrega starts with 'Text Input'.

     

    Would it be possible to remove the value within the 'Text' property. (or 'Value' property should you be using the modern / fluent UI control)

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard