cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mrunal
Level: Powered On

Sum of DataField in BrowseGallery

How to calculate Sum of all DataField from browsegallary. I have tried using formula

Sum(TextBox3)

but it is fetching only first card value . It is not taking values for all card. Suggest some help

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Steelman70
Level 10

Re: Sum of DataField in BrowseGallery

How about Sum(Filter(Source, XXX  > YYY), DataField) where XXX > YYY is the same filter condition as the gallery?

 

Alternatively you can:

  1. Put your filtered records in a collection with ClearCollect
  2. Set the Items of your gallery to this collection
  3. Set the sum text box to show the sum of the collection's data field

What is the event/trigger for the filtering of the data source?

 

If you post some screenshots or formulas it may be easier to help you.

View solution in original post

11 REPLIES 11
Steelman70
Level 10

Re: Sum of DataField in BrowseGallery

Hi, if I understood you question correctly, you should insert a text box outside the data gallery and set its text property to Sum(Source, DataField).  Please see this example:

 

 Capture2.PNG

 

PS The Text( ... , "#,###.00") around the sum is just for formatting

Mrunal
Level: Powered On

Re: Sum of DataField in BrowseGallery

I have filterd the datasource on BrowseScreen. Now I want calculate the result based on filtered data that currently showing on BrowseScreen

Highlighted
Steelman70
Level 10

Re: Sum of DataField in BrowseGallery

How about Sum(Filter(Source, XXX  > YYY), DataField) where XXX > YYY is the same filter condition as the gallery?

 

Alternatively you can:

  1. Put your filtered records in a collection with ClearCollect
  2. Set the Items of your gallery to this collection
  3. Set the sum text box to show the sum of the collection's data field

What is the event/trigger for the filtering of the data source?

 

If you post some screenshots or formulas it may be easier to help you.

View solution in original post

Power Automate Staff audrieg
Power Automate Staff

Re: Sum of DataField in BrowseGallery

I was trying to do this too. Did you get an answer outside of the forum on how to perform a SUM based on a filter? (I don't have a gallery in my case, I'm just summing data from a data source.)

Power Apps Staff rgruian
Power Apps Staff

Re: Sum of DataField in BrowseGallery

Hi Audrie,

 

Assuming for example you have a data source "ShoppingCart" with at least one numeric column e.g. "Price", and you want to sum over a filtered view of the the data source, e.g. if Price < 1000:

 

    = Sum(Filter(ShoppingCart, Price < 1000), Price)

 

Alternatively you can also fold the filtering logic into the aggregator itself:

 

    = Sum(ShoppingCart, If(Price < 1000, Price, 0))

 

Please do keep in mind however that aggregators such as Sum, Average, etc -- are not yet delegated to the data service back-end. This means they can only operate on up to 500 rows of data at the moment, until PowerApps gets aggregate query delegation support.

 

Radu Gruian [MSFT] ** PowerApps Staff
Power Automate Staff audrieg
Power Automate Staff

Re: Sum of DataField in BrowseGallery

Thank you.

 

Do you know if  "aggregate query delegation support" is planned this fiscal year or not?

Power Apps Staff rgruian
Power Apps Staff

Re: Sum of DataField in BrowseGallery

We are actively working on this feature. We will ship it as soon as it's finalized and deemed rock-solid.

 

Thanks for your patience.

Radu Gruian [MSFT] ** PowerApps Staff
Power Automate Staff audrieg
Power Automate Staff

Re: Sum of DataField in BrowseGallery

MVP it man! (Perfection is over-rated) Smiles

 

Thanks for all of your help!

Phyre
Level: Powered On

Re: Sum of DataField in BrowseGallery

You need to be specific about the column name.

 

This works as follows:

 

    Sum(Collection; [@ColumnName])    - Comma separators don't work for me (en-ZA)

    ~ or ~

    Sum(Collection, [@ColumnName])   - Comma separator seems commonplace for all other users Smiley Happy

 

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,703)