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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Group by gallery doesn...
Power Apps
Answered

Group by gallery doesn't return column to sum up

(0) ShareShare
ReportReport
Posted on by 24

Hello,

 

What I have is a galleryGrid gallery which is populated with the data from colGridData.

This collection consists of multiple columns but the most important is Title, and field_3 (which in my sharepoint list is called Circle).

Below is a sample based on these two columns.

TitleCircle (field_3)
1H202110
1H202116
2H202132

 

I need to perform following operations on these data:

1) Firstly, I group by this collection so after this step I get:

TitleCircle (field_3)
1H202126
2H202132

2) Secondly, I need to take the average of this two rows so my final result will be 29.

 

I thought that I found what I was looking for and I've tried to use this query in different forms but each time I'm not able to receive field_3 column from Data to sum it up and then proceed with these values.

 

 

AddColumns(
GroupBy(
galleryGrid.AllItems,
"Title", "Data"),
"Total Circle",
Sum(Data.field_3)
)

 

dasiekr_0-1666018003846.png

 

It seems like a problem is I can not access anything from "data" group.

I started using PowerApps a week ago so I'm not familar with some of concepts.

Categories:
I have the same question (0)
  • WiZey Profile Picture
    3,023 Moderator on at

    Hello @dasiekr ,

     

    You don't need to add "Sum()" here. "GroupBy()" will create a sub-table inside you collection under the "data" column you specified, and this sub-table will contain every rows under the same "Title".

     

    ClearCollect(
     cltNewCollection,
     GroupBy(
     cltOldCollection,
     "Title",
     "Data"
     )
    )

     

    Then only after can you use an algebra to compute the "Sum()" and the "Average()".

     

    Average(
     ForAll(
     cltNewCollection,
     Sum(
     ThisRecord.Data,
     Circle
     )
     ),
     Value
    )

     

    Hope this was helpful to you.

  • dasiekr Profile Picture
    24 on at

    Hi @WiZey ,

    This seems like something that will do the trick but is there a way to avoid creating another collection?

    Just one formula that will return that value?

    I would rather not make my app more complex.

  • Verified answer
    WiZey Profile Picture
    3,023 Moderator on at

    Sure, you just have to provide the "GroupBy()" to the "ForAll()" instead of using a new collection.

     

    Average(
     ForAll(
     GroupBy(
     collection,
     "Title",
     "Data"
     ),
     Sum(
     ThisRecord.Data,
     Circle
     )
     ),
     Value
    )

     

  • dasiekr Profile Picture
    24 on at

    @WiZey I'm not sure how I check it for the 1st time but now I have my former issue.

    In you query when I refer to ThisRecord.Data there is no Circle column available - only Title and Data.

    Could you help me with this? 

  • WiZey Profile Picture
    3,023 Moderator on at

    Sure, could you show me the code you wrote please? Maybe I missed something on my side.

     

    In the "Sum()" function, you can't use "ThisRecord.Data"? What if you use "Data" instead of "Circle" then? Does "Data" have any "Circle" property then?

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 414

#2
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 315 Super User 2026 Season 1

Last 30 days Overall leaderboard