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 II
Dual Super User II

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 II
Dual Super User II

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
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,907)