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 Platform Community / Forums / Power Apps / HELP! Need formula for...
Power Apps
Unanswered

HELP! Need formula for Sum Collection in Filtered Gallery

(0) ShareShare
ReportReport
Posted on by 12

Hi, I need to build a formula that sums the total of hours recorded into a label. 

 

This label needs to show after the gallery results have been filtered using a drop down list. 

 

The result needs to add up all hours posted to the Case File (e.g. Gadbrook Holdings)

 

As it stands I can get the label to add up ALL time but not to show it filtered based on user selection of the individual Case. 

 

Any help would be very much appreciated. 

 

List = Timesheet

Filter Button = Dropdown1

Label = Label2

Column = Hours

 

Main Screen - Hours.JPG

 

Thanks 

Categories:
I have the same question (0)
  • CarlosFigueira Profile Picture
    on at

    You can either use the same Filter expression that you have in the gallery in your sum expression:

    "Total Time Recorded: " & Sum(Filter(Timesheet, <same conditions as in the gallery>), Hours)

    Hope this helps!

  • Delvestio Profile Picture
    12 on at

    Hi @CarlosFigueira , Thanks for reaching out.

     

    I tried that and it returned an Invalid Argument?

     

    "Total Time Recorded: " & Sum(Timesheet,Filter( Timesheet,Case.Value = Dropdown1.Selected.Value),Hours)

     

     

  • Delvestio Profile Picture
    12 on at

    Error.JPG

  • Verified answer
    CarlosFigueira Profile Picture
    on at

    You will need to sum the filtered version of your Timesheet data source - the Filter expression will be the first argument of the Sum function:

    "Total Time Recorded: " &
     Sum(
     Filter(Timesheet, Case.Value = Dropdown1.Selected.Value),
     Hours)

    Hope this helps!

  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at

    You could do something as simple as: 

     

    Label2 = Sum(Gallery2.AllItems, Hours)

     

    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

    Hardit(Haman)

  • v-xida-msft Profile Picture
    on at

    Hi @Delvestio ,

    Based on the formula you provided, I think there is something wrong with it. I have made a test on my side, please consider modify your formula as below:

    "Total Time Recorded: " & 
    Sum(
     Filter(Timesheet, Case.Value = Dropdown1.Selected.Value),
     Hours
    )

     

    In addition, you could also consider take a try with the following formula without Filter formula:

    "Total Time Recorded: " & 
    Sum(
     Gallery2.AllItems,
     Hours
    )

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard