cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Sort a gallery based on one of the item results

So i totally lost on this one, I have a table similar to this one:
Fruit         Color     Amout
Apple      Green         2

Apple        Red          5
Banana    Green       10
Banana    Yellow       15

And I want a GALLERY that display the following results:

__________________
Banana        25

__________________
Apple           7
__________________

 

I tried using Distinc on the Item of the gallery so i get only one fruit, and crete a formula that sum all the fruits, but wasnt able to SORT it the right way (I want the biggest numbers on top, descending). I think i need to create a new table istead of using the old one. Any help? Am I clear enought with the problem?

(This is a simple example and the original problem consists of more "fruits" ands "colors")

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Sort a gallery based on one of the item results

Hi @PedroViviani 

 

 

SortByColumns(AddColumns(GroupBy(colDataBase,"Fruit","Name"),"Count",Sum(Name,Amount)),"Count",Descending)

 

colDataBase - anme of your data source - Table or collection

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

View solution in original post

2 REPLIES 2
Highlighted
Dual Super User
Dual Super User

Re: Sort a gallery based on one of the item results

Hi @PedroViviani 

 

 

SortByColumns(AddColumns(GroupBy(colDataBase,"Fruit","Name"),"Count",Sum(Name,Amount)),"Count",Descending)

 

colDataBase - anme of your data source - Table or collection

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

View solution in original post

Highlighted
Frequent Visitor

Re: Sort a gallery based on one of the item results

Thank you!
It worked as I wanted, I just added a filter on the source that i did not specified in the topic.
Thanks again @RezaDorrani !!!

 

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response 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 (8,505)