cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Sort, if duplicate get minimum.

Hello,
I have a list below called Rating

NameofStudentRatingDateRatingProvider
Arthur Morgan223-Sep-2020John Marston
Arthur Morgan423-Sep-2020Dutch Van der Linde
Arthur Morgan525-Sep-2020John Marston
Joe Cruz225-Sep-2020John Marston
Arthur Morgan427-Sep-2020Dutch Van der Linde

 

I am currently filtering my gallery below with only getting the NameofStudent

Filter(Rating,NameofStudent=Gallery.Selected.NameofStudent&& Rating <> "")

 

1. So the filter function will first filter the name of the student, depending on another gallery from previous page.
2. If there are two dates (23-Sep-2020) it will only get the minimum Rating.

3. Sort depending on Date. 
how can I do this all in one statement? to filter my current gallery

5 REPLIES 5
Highlighted
Memorable Member
Memorable Member

Re: Sort, if duplicate get minimum.

Hi ,

you can your Multiple sortByColoumn Properties as per your requirement. also try Sort Function hope this will also fit for your requirement.

like below

SortByColumns(SortByColumns(DataUserCollection,"User",Descending),"IsLiked",Descending).

VijayTailor_0-1600848736112.png

 




Highlighted
Helper V
Helper V

Re: Sort, if duplicate get minimum.

Hello @VijayTailor ,

 

Can you help me with my syntax? I'm not sure on how can I incorporate SortByColumns with my filter 

Filter(Rating,NameofStudent=Gallery.Selected.NameofStudent&& Rating <> "")

Thank you 

Highlighted
Memorable Member
Memorable Member

Re: Sort, if duplicate get minimum.

Hi,

Consider this Filter Part as Source - 

Filter(Rating,NameofStudent=Gallery.Selected.NameofStudent&& Rating <> "")


You can use like below

SortByColumn(SortByColumn(Filter(Rating,NameofStudent=Gallery.Selected.NameofStudent&& Rating <> ""),"FieldName",Ascending),"SecondFieldNamethatyouwant2Sort",Ascending)
Highlighted
Memorable Member
Memorable Member

Re: Sort, if duplicate get minimum.

This is another way with One SortByColumn


SortByColumns(Filter(Rating,NameofStudent=Gallery.Selected.NameofStudent&& Rating <> ""),"User",SortOrder.Descending,"IsLiked",SortOrder.Descending)


Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Helper V
Helper V

Re: Sort, if duplicate get minimum.

In addition, I only need to limit the gallery into only three rows. So it will only show the three latest rows depending on date.
1. Filter the name of student and get not blank/empty rating

Filter(Rating,NameofStudent=Gallery.Selected.NameofStudent&& Rating <> "")

 2. If there are two different Rating Provider who gave rating on the same date then it will only get the minimum grade. 

3. Sort depending on the date.

4. Show only 3 rows from the list.

 

I'm not sure if I can combine all these 4 in one statement of Item Gallery.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,714)