web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Filtering initial values in Gallery

(0) ShareShare
ReportReport
Posted on by

I'm trying to display items in a gallery, but filter by a column that is text. Example below:

 

Item Number

Item Title

Item Description

Item Health

 

I want to ONLY show the items with Item Health = to "1 Red" or "2 Yellow" or "3 Green"....

 

This is for a sort of "dashboard" app. The data source is a list view. I can see all the values, I just can't get the initial filter to work right. Ideas?

I have the same question (0)
  • Marek Profile Picture
    43 on at
    Re: Filtering initial values in Gallery

    Hi

     

    I am sorry im not very good at understanding things, but

     

    If you select Gallery on the left (1), then choose property Items (2) there is a value (3).

    Its is like "NameOfDataSource" (For my case it is SharePoint Online list called "PosunutyCas1")

    If I set only "PosunutyCas1 it get all items by default".

     

    With Filter function I try to filter this list to only items which column ID=1 or ID=1 (sorry but its nonsense the same value)

    But in your case maybe Filter(MyList1;Health="1 Red" || Health="2 Yellow" || "3 Green")

     

    (I have not english language, so formula separators etc syntax may be different, in english documentation and example:

    https://powerapps.microsoft.com/en-us/tutorials/function-filter-lookup/

     

    But i will try first like Filter(MyList1,Health="1 Red")

     

    filter.png

     

  • Community Power Platform Member Profile Picture
    on at
    Re: Filtering initial values in Gallery

    I tried this and cannot get it to work either way. I have tried just about everything to get this to sort by the correct column, and cannot get it to work. It will only sort by the default formula:

     

    SortByColumns(Filter(MyList, StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

     

    Where in the above statement would I put more filter criteria? This statement provides the entire list, and you can search by "Title" in a search bar at the top. I get all that....what I do NOT get, is how to add in more filter criteria.

  • Verified answer
    Brian Dang Profile Picture
    3,976 on at
    Re: Filtering initial values in Gallery

    Current:

    SortByColumns(
     Filter(MyList, 
     StartsWith(Title, TextSearchBox1.Text)
     ), 
     "Title", If(SortDescending1, Descending, Ascending)
    )

    If you want to add more conditions, you would place it in this red spot:

    SortByColumns(
     Filter(MyList, 
     StartsWith(Title, TextSearchBox1.Text) &&
     column=value
     ), 
     "Title", If(SortDescending1, Descending, Ascending)
    )

    You could use && to mean "and" or you can use a comma in the Filter formula:

     

    SortByColumns(
     Filter(MyList, 
     StartsWith(Title, TextSearchBox1.Text),
     column=value
     ), 
     "Title", If(SortDescending1, Descending, Ascending)
    )

     

    Repeat that for as many conditions as you want.

     

    Let me know how it goes. 

  • iOkidoki Profile Picture
    2 on at
    Re: Filtering initial values in Gallery

    Hi,

     

    Thanks for taking the time to help.

    Please I am using similar code but I am having problem searching on the mobile or when using the link to test.

    This is my code:

    SortByColumns(Filter('PowerApps BOW',StartsWith(Title,TextSearchBox1.Text)),"Title", If(SortDescending1, Descending, Ascending))

     

    When I test the search from the https://create.powerapps.com/studio/#

    The search works fine, but no so when I test is with mobile or using the link, also other users can not search from their devices.

    Please can you help?

     

    Thank you.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 655 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 391 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 225

Last 30 days Overall leaderboard