cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dallenap
Advocate II
Advocate II

Sum Total in Gallery

I'm struggling trying to figure out how to sum a total in gallery.

 

I have an input form that creates an item and updates the collection that is displayed in a gallery.  The user inputs an item and a cost is calculated.  When saved, the gallery's collection is updated with that item and the cost.  The gallery is also editable so the user can change the item's quantity and thus change the total line item cost.  I'd like to have a sum total of all the line item costs.  

 

Something like this fails to update when

Sum(Gallery1.AllItems, Value(TotalItemCost.Text))

 

TotalItemCost is calculated by multiplying the item cost by the quantity.  The user can edit the quantity in the gallery.  The TotalItemCost calculates correctly.  However, the sum of the TotalItemCosts will not update when the user changes the quantity of the line item in the gallery.  

 

I'm sure I'm missing something simple.  Any advise would be appreciated.

 

Thanks,

Dan

3 REPLIES 3
RandyHayes
Super User
Super User

@dallenap 

Your formula appears correct.  Make sure you are actually addressing the proper controls - Is TotalItemCost as label?  Is Gallery1 the right Gallery?

If TotalItemCost is actually updating on the Gallery, then your Sum should as well.

 

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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

@RandyHayes 

 

Yes, all the controls are correctly addressed.  TotalItemCost updates properly on the Gallery.  The Sum updates properly only once.  When I add the label control and set the text to Sum() the correct value is calculated.  However, any changes to the values in the gallery are not resulting in the Sum being updated to the correct value.  It remains at the initial value.

 

 

 

 

@dallenap 

That is a bit bizarre.  So, what I might do to troubleshoot is to create another Gallery and set the Items property to Gallery1.AllItems

Then put a label in the gallery and set the Text property to Value(TotalItemCost.Text)

See if those values change in concert with changes in Gallery1.

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,204)