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 / How to Sum table value...
Power Apps
Answered

How to Sum table value if empty text are present

(0) ShareShare
ReportReport
Posted on by 249

I have a gallery which has data as follows

where ID , label, time are the label controls used to display the values 

IDlabeltime
1mon1
2tue 
3wed4

 

I wanted to calculate sum of time column wise without modifying the UI ie Text Property of label in gallery blank to 0. I want to keep this view as it is

 

 

 

 

 

 

Sum(gal_WorkTime.AllItems.lbl_time , lbl_time.Text)

 

 

 

 

 

 

lbl_time is the control of time whoes text value I need to sum up for time. but Im getting errors as there are empty or Blank values I wanted to replace it as 0 before calculating sum. How to do that?

 

 

My formula 

 

 

 

Clear(V1);
ForAll(
 gal_WorkTime.AllItems,
 If( IsBlank(lbl_time .Text),
 Collect(V1,{Value:0}),
 Collect(V1,{Value:Value(lbl_time .Text)})
 )
)

 

 

 

 Here I replace 0 in text in collection but How to show it in a label control without any user clicks on button to execute this command?  Basically without user's click on any button I want to use this formula to show the sum in a label.

Categories:
  • zmorek Profile Picture
    3,272 on at

    This should work, assuming the column containing the number to be summed is a number format:

    Sum(gal_WorkTime.AllItems, TimeColumn) 

  • pcakhilnadh Profile Picture
    249 on at

    @zmorek  No that assumption is wrong. It is text value. It is clearly explained in the question

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @pcakhilnadh 

     

    Set the Text property of Label to

     

    Sum(gal_WorkTime.AllItems, If(IsBlank(lbl_time.Text),0,Value(lbl_time.Text)))

     

     

  • pcakhilnadh Profile Picture
    249 on at

    @StalinPonnusamy  As mentioned in question , I'm looking for solution without modifying the Text property of label in gallery. I wanted to keep the UI as it is. Just want the sum in another label. 

  • Verified answer
    StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @pcakhilnadh 

     

    I provided the solution to show sum on the label, not for a gallery. 

     

    • Insert a Label on your screen
    • Set Text Property of Label to
    Sum(gal_WorkTime.AllItems, If(IsBlank(lbl_time.Text),0,Value(lbl_time.Text)))

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard