Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Sum() Collection within Gallery

(0) ShareShare
ReportReport
Posted on by 75

Hi all, can someone please point me to the right direction. I have a txtLabel outside of the gallery where I use it to sum the total number input within the gallery.

nicklimcs_3-1713337569660.png

 

Below is the txtLabel Text property. The output I am expecting is 9 instead of 10. 

 

Sum(galTasks.AllItems, numInputPartner.Value)

 

 

Another example, the output should be 1 instead of 2

nicklimcs_5-1713338013293.png

 

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 145,580 on at
    Re: Sum() Collection within Gallery

    @nicklimcs ,
    As long as both the gallery and your sum label are in the same container, it should work.

  • Verified answer
    nicklimcs Profile Picture
    nicklimcs 75 on at
    Re: Sum() Collection within Gallery

    @WarrenBelz @v-mengmli-msft 

     

    So it turns out that it won't sum properly if the text input control is within a Container sitting in a Gallery.

    nicklimcs_0-1713393323239.png

     

    In another post, they suggested to create a txt label directly in the Gallery and reference to the txt input within the Container. Then sum the txt label to get the result which is working for me. 

    nicklimcs_1-1713393410663.png

     

    Is this a bug or is there another way to change the formula for it to work?

  • WarrenBelz Profile Picture
    WarrenBelz 145,580 on at
    Re: Sum() Collection within Gallery

    @JamesYumnam ,

    Please tag me if you want further assistance - the Classic Text Input certainly should work.

  • Re: Sum() Collection within Gallery

    Hi @nicklimcs ,

     

    It's wired, your original formula should be work. Are there other formulas on the TextInput?

    Maybe you can try this first.

    Sum(AddColumns(galTasks.AllItems,"Input",numInputPartner.Value),Input)

     

    Best regards,

    Rimmon

  • JamesYumnam Profile Picture
    JamesYumnam on at
    Re: Sum() Collection within Gallery

    Hi @nicklimcs , as previously suggested by @WarrenBelz, the below Sum() works in my case.

    JamesYumnam_0-1713341695299.png

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Explore my blog James Yumnam

  • nicklimcs Profile Picture
    nicklimcs 75 on at
    Re: Sum() Collection within Gallery

    Hi @WarrenBelz 

     

    No luck with any of it, still having the same problem unfortunately.

  • nicklimcs Profile Picture
    nicklimcs 75 on at
    Re: Sum() Collection within Gallery

    Hi @v-mengmli-msft 

     

    In my case, there's only ONE txtInput within the gallery. The reason you're seeing two is because the Collection has two rows of record. 

    nicklimcs_1-1713340519606.png

     

    nicklimcs_0-1713340426650.png

     

  • WarrenBelz Profile Picture
    WarrenBelz 145,580 on at
    Re: Sum() Collection within Gallery

    Hi @nicklimcs ,

    Firstly try

    Sum(
     galTasks.AllItems, 
     Value(numInputPartner.Value)
    )

    If that does not work, but in a Classic Text Input and use

    Sum(
     galTasks.AllItems, 
     Value(TextInputName.Text)
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • Re: Sum() Collection within Gallery

    Hi @nicklimcs ,

     

    Do you want to sum all items with "Meeting with clients" + "Draft"?

    Please try this.

     

    Sum(AddColumns(Gallery.AllItems,"sum",Value(TextInput1.Text)+Value(TextInput2.Text)),sum)

     

    vmengmlimsft_0-1713338994016.png

     

     

    Best reards,

    Rimmon

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard