web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / label field formula do...
Power Apps
Answered

label field formula doesn't update when input field change

(0) ShareShare
ReportReport
Posted on by 31

Hello,

Following this article: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-formulas if i sum input text fields and display through a Label field, then label field should display changes as soon input text field value change.

 

but it's not happening in my case.

 

i have a gallery with input text fields, and a formula I am using in a label field to display the sum of input text fields is:  Text(Sum(ProjectGallery.AllItems,'Year 2'),"[$-en-US]$#,###") 

 

Even if i remove formating, it still doesn't display changes as when they happen. 

Sum(ProjectGallery.AllItems,Value('Year 1'))

 

the label field only refresh sum when I patch the data after making changes and it refreshes a gallery.

 

Any idea if i am missing anything here? or how can I achieve this behavior?

 

Many thanks.

Categories:
I have the same question (0)
  • leyburn19 Profile Picture
    2,157 on at

    How are you changing the field in teh gallery.  If you are not patching when the change,  the default field is not updated.  the field must be update first.

     

    On the on change event to the control use Patch(Source,First(Filter(Source,ID=ThisItem.ID)),{Column:Value(Textinput?.Text))

     

    Source = datalist

    Column= Column to change in list

     

  • KhurramJamshed Profile Picture
    31 on at

    thanks for your reply @leyburn19 

    I can see what you are explaining.

    I am patching, but when I have to commit the final changes of field Year1 and others.

    My idea is to display sum dynamically while the user is making changes to Year1 field BUT NOT committed yet.

     

    Now if the default value is not updated because i haven't patched the data yet, how else I can achieve the same result?

     

  • Verified answer
    leyburn19 Profile Picture
    2,157 on at

    Not sure if this will work,  but

     

    Have your sum based on the input field instead of the Gallery.   

     

    So the default for the field would ThisItem.Value.  On change it is now the new value.  Have your sum field simply sum those values. not the source value.  When you patch it is will update those value now and will still be the same

     

    I am note sure how the sum() will reference that field but worth a try.

  • KhurramJamshed Profile Picture
    31 on at

    thanks again @leyburn19 
    your reply (Have your sum based on the input field instead of the Gallery.   ) has put me in the right direction, i was actually summing up the source field instead of an input text field.

    and that was the reason of this issue.

    Once i changed my Lable field sum formula to read the value from an input text field, it started behaving as expected.

     

     

  • v-yutliu-msft Profile Picture
    on at

    Hi @KhurramJamshed ,

    Do you want the sum of one field changes when textinput change?

    Is Year 1' a fieldname?

    If so, let me firstly explain why this only change you patch the changes:
    Sum(ProjectGallery.AllItems,Value('Year 1'))  will calculate the sum of Year 1' field in data source.

    Since you have not patched the changes, the year1 value in data source has not changed.

     

    If you want to change before you patch, you need to make a little change, try this:
    1)set the textinput's OnChange:

    Set(var1,ThisItem.'Year 1');
    Set(var2,textinputname.Text)

    2)set the sum label's Text:

    Sum(ProjectGallery.AllItems,Value('Year 1'))-Value(var1)+Value(var2)

    Then you will minutes this record's original year1 value and plus the new data that you entered in .

     

     

    Best regards,

  • KMI-Keith Profile Picture
    115 on at

    Yup, thank you for this! Not OP but had this same issue and the Patch() just would not show the updated values after the patch and was causing an issue but Sum() of the label in the gallery worked perfectly!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 740 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 342 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard