Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum in Gallery once Patch is done

Hi all,

Is there a way to show an updated sum of values once patch is done?

Initially, my Gallery1 has an item A quantity is 1.

When a customer placed an order, the data is patch to the SPO list and creates a new record with Item A quantity -1.

The SUM in SPO of item A is 0. 

But in gallery1, the quantity is still 1.


Below is the label, text input:

"Available Quantity: " & Text(Sum(ThisItem.'AvailableQuantity'))
I'm not sure if this needs a statement to refresh gallery or screen.
Thanks for the help in advance!

Accepted Solutions

ok so you want to view the item and the total in the gallery.


you will have to add a column and .. addcolumns(GroupBy(yourSharePointList,"ColumnToGroup","Balance"),"AggregateIt",Sum(Balance,ValueColumn))


add a label in the gallery and set the text to thisitem.AggregateIt


hope it helps

View solution in original post

Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

You can use the below code below the patch code. on Button OnSelect properties.


Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Not applicable

Hi @VijayTailor ,


Added the refresh to the patch function.

The item A still has quantity of 1 in gallery.




Super User
Super User

hi there have you tried refreshing the data, Refresh(yourdatasource). patch is only updating the SP list, the data in your gallery is the same unless you refresh it.

Hi @Anonymous ,

In that Scenario,

if you are using the Collection for Gallery then you also need to Update the Collection.


hi there


please check this



Not applicable

Hi @rubin_boer ,

Not intending to use another label outside the gallery.

The label has to be in the gallery.


Hi @VijayTailor ,

The gallery is picking the data source directly from SPO list.




Super User
Super User


If you are just displaying the AvailableQuantity, can you explain more about where Sum comes into this?


Your formula for the label should be:

"Available Quantity: " & ThisItem.'AvailableQuantity'

If you are truly connected to the SharePoint list in your Items property, there is NO need to refresh after a Patch or Update.  The Gallery as well does not need to be Refreshed.


But, I am curious about your use of Sum in your original formula.


I hope this is helpful for you.

Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @Anonymous ,

As i tried, working perfectly fine for my side

Please have a look into the below-mentioned URL for see  the Test Demo.


Not applicable

Hi @RandyHayes ,


Removed the SUM in the text label within the gallery, the quantity still gives me 1 in the text label.




Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,622)