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 function in galler...
Power Apps
Unanswered

Sum function in gallery/collection causes errors

(0) ShareShare
ReportReport
Posted on by 149

Hi!

 

I am facing some issues with the sum function within in my gallery.

 

For the background:

 

I create a collection with lines which should be patched with number columns in sharepoint afterword.

 

ClearCollect(

    Tätigkeiten;ForAll(Sequence(3);

    {

        LineGJ21Q1APV:"0";LineGJ21Q2APV:"0";

        LineGJ21Q3APV: "0";

        LineGJ21Q4APV: "0")

 

 

ForAll(

    'Gallery Neues Arbeitspaket Tätigkeit'.AllItems;

    Patch(

        '3400 ILLU Arbeitspakete O3.4';

        Defaults('3400 ILLU Arbeitspakete O3.4');

        {

            GJ21Q1APV: Value('Input GJ21Q1'.Text);

            GJ21Q2APV: Value('Input GJ21Q2'.Text);

            GJ21Q3APV: Value('Input GJ21Q3'.Text);

            GJ21Q4APV: Value('Input GJ21Q4'.Text)}))

 

The inputs inside my gallery (data source is my collection “Tätigkeiten”) are Text inputs.

 

But I want to sum them. So I put text inputs inside my gallery with default property Sum('Input GJ21Q1';'Input GJ21Q2').

 

But after I have run the app and review its performance it says errors: This value can not be converted into a number because value consists of empty string.

 

 

I tried a lot of things like changing from text input to number input. I changed the clear collect function to this:

 

ClearCollect(

    Tätigkeiten;ForAll(Sequence(3);

    {

        LineGJ21Q1APV;0LineGJ21Q2APV:0;

        LineGJ21Q3APV: 0;

        LineGJ21Q4APV: 0)

 

But nothing works to avoid these errors.

 

Please help me with this!

 

 

Thank you very much5E00998E-C447-46E0-B4DD-23E045F84D41.jpeg

Categories:
I have the same question (0)
  • _Nils_ Profile Picture
    71 on at

    Hi,

    I think converting the textinputs into numbers within your sum function should work.

    Does this work for you? :

    Sum( Value( 'Input GJ21Q1'.Text); Value( 'Input GJ21Q2'.Text))

     

    Also, if these labels are inside a gallery you would have to use: ThisItem. 'Input GJ21Q1'.Text

  • Jasmin_Sch Profile Picture
    149 on at

    Thank you @_Nils_ 

     

    no it does not work

     

    Just for summary

    this my function to create a collection

    ClearCollect(

        Tätigkeiten;ForAll(Sequence(3);

        {

            LineGJ21Q1APV:"0";LineGJ21Q2APV:"0";

            LineGJ21Q3APV: "0";

            LineGJ21Q4APV: "0")

    text inputs with default ThisItem.LineGJ21Q1

     

    The summary Input is also a text Input but it does not make a difference if I change it to number.

  • _Nils_ Profile Picture
    71 on at

    Could you give some more information about what you are trying to accomplish and when the error occurs exactly?

    As far as I understand, you are creating a collection "Tätigkeiten" which is displayed in a gallery.
    In this gallery you have textinputs showing the values of each column (using ThisItem.* as default) as well as a textinput which is suppost to sum all the values from the collection for each line (using Sum(ThisItem.*; ThisItem.*)).

    Is this correct? When does the error occur exactly? Could you share a screenshot and brief description?

  • Jasmin_Sch Profile Picture
    149 on at

    @_Nils_ Of course thank you for your help

     

    It says: Value can not be converted into number because value is an empty string.

    9429520D-9CF0-4E6D-AC38-FD9E2DD89918.jpegBD43CF01-50FA-4A69-ABDF-FFC410FFC45D.jpeg9CAD1BFE-BB33-4C63-9C19-1EF5EF79229E.jpeg

  • Jasmin_Sch Profile Picture
    149 on at

    @_Nils_ Band the error occurred after I have created my collection

  • _Nils_ Profile Picture
    71 on at

    unfortunately I cannot reproduce this error as it just works for me.

    _Nils__0-1618927101545.png_Nils__1-1618927163132.png_Nils__2-1618927190984.png_Nils__3-1618927215068.png

    So I can only suggest the classic close and restart Powerapps or maybe try renaming the collection and see if it was just some internal thing.

    Otherwise I don't really have any ideas

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 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard