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 / Get total value from a...
Power Apps
Answered

Get total value from a collection

(0) ShareShare
ReportReport
Posted on by 271

Hi,

I have a collection in the power app which I created based on Groupby() which looks like following 

 

ClearCollect(coltest,AddColumns('TimeSheet App_TimeEntries',"EMP",Employee.DisplayName));


ClearCollect(colc,GroupBy(coltest,"EMP","Week_x0020_Start","DATA"));

Aysan_0-1694705688222.png

in the DATA table, I have a column called Total

Aysan_1-1694705779423.png

I am wondering what is the best way to create a gallery which shows "EMP", "WeekStart" and "Sum(Total)" from the DATA table for each employee

Thank you so much!

Categories:
  • Verified answer
    v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Aysan ,

     

    Do you want to display the total value of the Total column in each DATA sub-Table in Gallery?

    Please try this:

    Create a Gallery and insert a Label control.

    Set the Text of the Label:

    Sum(ThisItem.DATA,Total)

     

    Hope this helps you!

    -------------------------------------------------------------------------------------------------------------------------------

    If my answer solves your problem, please accept it as a solution to help more people stuck on the same problem find it.

     

    Best regards,

    Rimmon Li

  • Aysan Profile Picture
    271 on at

    Thank you so much  @v-mengmli-msft , Would you please let me know how can I create a new collection using the sum(thisitem.DATA,Total) as a column rather than a table?

    I would like to have a collection such as the following. 

    Aysan_0-1694793081378.png

    Thank you !!

  • Aysan Profile Picture
    271 on at

    To anyone who might look for a solution to merge and create a new collection, I ended up using the following code:

    ClearCollect(coltest,AddColumns('TimeSheet App_TimeEntries',"EMP",Employee.DisplayName));
    ClearCollect(colc,GroupBy(coltest,"EMP","Week_x0020_Start","DATA"));
    
    ClearCollect(colcoll,
    ForAll(Sequence(CountRows(colc)),
    {
    _hours:Sum(Index(colc,Value).DATA,Total),
    _EMP:Index(colc,Value).EMP,
    _Week:Index(colc,Value).Week_x0020_Start,
    _Approval:First(Index(colc,Value).DATA).Status.Value
    
    }))

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard