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 / Gallery to filter by t...
Power Apps
Answered

Gallery to filter by two fields and sort by one field on top and then the other. Then sort by number

(0) ShareShare
ReportReport
Posted on by 301

Hi,

 

I have an app with a gallery that downloads from a sharepoint list with 5 different fields

 

Status, ITEMID, Lat, Long & ITEM2ID

I have a Status dropdown with four items in it ["Default","Pending","Finished","Started"] and all the rows have either status as Started, Pending or Finished, First I would like the gallery to filter by a dropdown and when the app loads the "Default" option i would like it to filter by Started at the Top and Pending underneath and pending to be sorted by ITEMID ascending.

 

The Gallery currently has this as the item code

SortByColumns(
 Search(
 Filter(
 colData,
 Status = ddStatusFilter.Selected.Value),
 TextSearchBox.Text,
 "ITEMID"),
 "ITEMID",
 If(SortDescending1, Descending, Ascending))

 

Ive tried many things to get it too filter by if statments of started and pending but cannot figure it out.

 

Could someone help with the code

 

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

    Hi @ShaneITAutomate ,

    This will sort by Status in the order Started, Pending, Finished, Default with the items within them sorted by ITEMID Ascending and also allows for the box to be blank (then shows all records)

    SortByColumns(
     Search(
     Filter(
     colData,
     (
     IsBlank(ddStatusFilter.Selected.Value) ||
     Status = ddStatusFilter.Selected.Value
     )
     ),
     TextSearchBox.Text,
     "ITEMID"
     ),
     "Status",
     "Descending",
     "ITEMID", 
     Ascending
    )

     

    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.

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 355 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard