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

GroupBy - Count of Items

Hi

I am trying to grou items in a collection which is shown in a gallery. I just need the groups (by name) and then total count of items within it. Is this possible?

So results will be like

 

Group1 - Agrifood Technology

Count (2)

 

Group2 - Albury City Council

Count (1)

 

 

 

Thanks

Annotation 2019-10-02 092734.jpg

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Here’s some code that will help you group the results. Replace your_datasource_name with the name of your datasource. Also replace CustomerName with the actual field name for customer.

The field names for ByCustomer and CustomerCount are completely made up so you can change those to whatever makes sense.

ClearCollect(myDataSummary,
    ShowColumns(
        AddColumns(
            GroupBy(your_datsource_name, "CustomerName", "ByCustomerName"),
           "CustomerCount",
            CountRows(ByCustomerName)
        ),
   "Menu",
   "CustomerCount"
   )
)


—-
Please Accept as Solution if this post answered your question so others can find it quicker. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

1 REPLY 1
Super User III
Super User III

Here’s some code that will help you group the results. Replace your_datasource_name with the name of your datasource. Also replace CustomerName with the actual field name for customer.

The field names for ByCustomer and CustomerCount are completely made up so you can change those to whatever makes sense.

ClearCollect(myDataSummary,
    ShowColumns(
        AddColumns(
            GroupBy(your_datsource_name, "CustomerName", "ByCustomerName"),
           "CustomerCount",
            CountRows(ByCustomerName)
        ),
   "Menu",
   "CustomerCount"
   )
)


—-
Please Accept as Solution if this post answered your question so others can find it quicker. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (35,179)