web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

GroupBy in Gallery

(0) ShareShare
ReportReport
Posted on by 349

Am confused by GroupBys in PowerApps.

We are trying to create a simple GroupBy in  a gallery. The source data is in a collection called ECollection and it has a number of fields/columns in it: 

 

 
CustomerId,
LocationId,
PRM_Asset_Id,
EID,
Service_Call_ID,
LocationName,
CustomerName,
Branch,
LocationStatus,
Manufacturer_ID,
EType,
Model_Number,
Serial_Number,
Expiration,
Install_Date,
Location,
Bar_Code,
Optimal,
RType,
AssetId,
Verified,
ManufactureDate,
Size,
Installed_By,
Description,
MDFUSRID,
Timestamp
 
We have a gallery and we just want to display only two fields in the gallery:
the EType and the count of the items for each EType. 
 
EType     Count
A               7
B               3
D             16
 
What is the simpliest way for us to do this ? Can a Gallery have a group by statement in the "Items" property, or is it best to perform the GroupBy on a new collection from the ECollection ?
 
And what would the forumla be?
 
Thank you
Categories:
I have the same question (0)
  • NPrice99 Profile Picture
    1,302 on at

    Hi @vsslasd

     

    @Mr Dang has just done a master class in GroupBy - this should help

    -> https://powerusers.microsoft.com/t5/General-Discussion/Combining-Fields-Into-a-Record/m-p/212359/highlight/false#M67751

     

    Regards

     

    Nigel

  • vsslasd Profile Picture
    349 on at

    Thank you. I'm looking at it. It's a bit confusing.

  • Verified answer
    PaulD1 Profile Picture
    2,914 on at

    For the items property of the Gallery:

    GroupBy(ECollection,"EType","grp")

    Then add two labels to the gallery, in the first set the text property as follows:

    ThisItem.Etype

    And in the second (to give the count) set the text property as follows:

    CountRows(ThisItem.grp)

    The GroupBy gives you a hierarchical recordset in which all the grouped columns/rows go into a 'subtable' called "grp' (or whatever name you use in the last argument of your GroupBy.

  • vsslasd Profile Picture
    349 on at

    Thank you! Much simple !

  • vsslasd Profile Picture
    349 on at

    That works totally great!

    The column on the left works fantastic and the countrows works perfectly.

     

    We need to also count the rows if the Verified column = true.

     

    Just a little confused on how that needs to be handled in PowerApps. I'm thinking the Verified column needs to be converted to a number in the original collection, and then it can properly be summed up in the groupby Gallery ?

     

    My gallery items = GroupBy(ECollection, "EType","grp")

     

    verified.png

     

    Thank you

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard