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 / Conditional Formatting...
Power Apps
Answered

Conditional Formatting Gallery to check the sum of the fields

(0) ShareShare
ReportReport
Posted on by 26

Hello, I am fairly new to power apps and mocking up an app to gather a variety of data to upload to a SQL server.

I have got a gallery with multiple job roles, their salary and then the % of areas they work in. 

In the database 1 = 100% so I have used this formula.

 

 

 

Text((ThisItem.StaffPercHost*100),"[$-en-US]0%")

 

 

 

 I want users to be able to edit the data and the % spread of each role, however, I do not want them to give a role a % spread not equaling 100%. 

 

After editing the data, there is a save icon using the below formula

 

 

 

Select(Parent);
Patch(
 '[dbo].[fp_tco_stafftable]',
 {StaffID: ThisItem.StaffID},
 {
 StaffRoleName: txtStaffRoleName.Text,
 StaffSalary: Value(txtStaffSalary.Text),
 StaffPercHost: Value(txtStaffPercHost.Text)
 }
);
Set(
 itemId2,
 0
)

 

 

 

I would like an error to appear when attempting to submit IF the total % spread is not exactly 100%. It would also be nice to have a total % column so the user can see how much they are over or under... or even better yet, a count down column to say how much % is left to be distributed for that row. I'll add a screenshot to try better explain. Thank you in advance!

 

Screen Shot 2020-08-12 at 21.13.36.pngScreen Shot 2020-08-12 at 21.23.02.png

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @CoStratify 

    You can utilize the Sum function for what you are trying to achieve.

    In your case you will use the Gallery.AllItems as the source to Sum.

    So, if it is the txtStaffPercHost control that has that value, then consider this formula for a sum:

    Sum(yourGallery.AllItems, Value(txtStaffPercHost.Text))

    You can then use that perhaps in a label (outside of your gallery) to display the sum and perhaps with some more math, the remaining.

    You could then use that to control the visibility of an error label.

    SO...let's say you put the Sum formula above in the Text property in a label outside your Gallery called lblPercentSum.

    Then, you could put another label (let's call it lblSumError) outside the Gallery that would have the "error" text in it and set the Visible property to the following:

    Value(lblPercentSum.Text) <> 100

    This would display if the value is not equal to 100.

    Then, for your "Save" icon, set the DisplayMode property to the following:

    If(lblSumError.Visible, Disabled, Edit)

    That would disable save/submit if they have incorrect sum of percentages.

     

    I hope this is clear and helpful for you.

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 70

#2
WarrenBelz Profile Picture

WarrenBelz 64 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 36 Super User 2026 Season 1

Last 30 days Overall leaderboard