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 / Sum of items in a dyna...
Power Apps
Answered

Sum of items in a dynamic Gallery

(0) ShareShare
ReportReport
Posted on by 65

I encounter a situation, that I put specially filtered items into a Gallery, and define some more complicated formula in each cell in the Gallery, put it in a text box. Then outside of the Gallery, another text box is defiined to be the sum of all these text boxes in the Gallery. 

The result came out correct when first evaluated. But when the program do anohter screen, and have a new output of the Gallery, I found the calculated result did not get updated. 

 

Can SUM function work on the Gallery.Allitems as it's input?

 

Martin

Screen.png
Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi,

     

    You mean that your sum isn't updating with your filter ?

    For me it's working well, it's maybe because you have a lot of data, so it's a little bit slower ?

     

    Louis

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi, 

     

    You could add a formula to refresh the gallery when the screen loads. Please refer to the screenshot below: 

     

    Picture2.png

     

     

    You could also add a button to refresh the gallery (data source) so that you get the current/ latest data and the sum in the required field.Picture3.png

     

    Please note: Autonumber and Autonumber_1 are my data sources. You can replace that with yours. 

     

    Hope this helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

  • MartinSun2000 Profile Picture
    65 on at

    Nope, it doesn't work. Actually, when I first ener the formula, it works OK (See picture 2).

    Then after I go somewhereelse, and come back with the Gallery content changed, the contents in the Gallery was updated (see pictrure 3), but the content in the box outside did not get updated. The page OnVisible also contains a Refresh command, but it did not change anything.

    Until I change the formula in the box again, it is updated (see picture 4). 

    I wonder if the Sum does not apply to the Gallery type of table? Or at least not populated automatically?

     

    Martin

    3.PNG
    4.PNG
    2.PNG
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey! Can you share where are you extracting the data from? Is it sharepoint or CDS or soem extrenal data source? 

    If so, in the formula, you have to enter the name of the column at the data source. 

    Sum(Gallery4.AllItems, custControl)

    Here custControl is the name of the column at my source and this column has been mapped to a label "Label_2" in the Canvas app. So it gives the desired results when i put the coulmn name instead of the [Label_2.Text]. 

     

    Hope this helps!

     

  • corey_msft Profile Picture
    Microsoft Employee on at

    @MartinSun2000 We have identified an issue with Gallery when aggregating values via the .AllItems property.  We are actively working on a hotfix.  We will keep the thread posted as we know more.  Sorry for any inconvenience.

  • Verified answer
    MartinSun2000 Profile Picture
    65 on at

    I thought I have posted an update last night on more explanation, but seems it got lost somewhere. 

    More on describing the situation: the CustomControl in the Gallery is not only a simple column, but is a calculation based of several column and a LookUp call to other list. (see picture 5). That's why I could not call the Column direcly from the textBox outside the Gallery. 

     

    But I found a temporary solution, by adding a button and do the "manual" calculation every time I come to this page. For the moment, an acceptable solution. 

    6.PNG
    5.PNG
  • corey_msft Profile Picture
    Microsoft Employee on at

    @MartinSun2000 I'm glad you were able to solve your problem! 

  • MartinSun2000 Profile Picture
    65 on at

    But I just discovered that, the program actually worked before without this kind of problem. 

    I tried to recover the program to a earlier version (about 5 days ago), it does not have the Fix I adde, but it worked from the begining, until I save it and publish it again, then it doesn't work. 

     

    I also foudn that many of my other program that make the same call of Gallery.Allitems  all start to act strangely recently. (They do not seems to populate the function called, see attached picture 7). 

     

    Is there a bug recently?!

    7.PNG
  • corey_msft Profile Picture
    Microsoft Employee on at
    Yes. A regression in gallery was inadvertently shipped. A hotfix has been validated and is approved for deployment. Once deployed, you will need to edit your app(s) in Studio and re-publish. I will update this thread once hotfix deployment is complete.
  • corey_msft Profile Picture
    Microsoft Employee on at

    Update: We are still working to deploy the hotfix. We encountered a technical issue which prevented us from deploying sooner. I will update this thread again once hotfix deployment is complete.

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
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard