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 / Shopping Cart total am...
Power Apps
Answered

Shopping Cart total amount using If function and Checkbox condition for a roundup

(1) ShareShare
ReportReport
Posted on by 13

Hi community, 

 

I'm trying to find the right formula to calculate :

1- the Sum of my collection Shopping cart (as a Subtotal)

2- If a RoundUp CheckBox is ticked, then to Roundup the SubTotal, if not to keep the originalo SubTotal

3- to Add a Value from a TextInput for additional donation (for charity)

 

Here is what I was doing but It doesn't work and I don't know what to change: 

 

With( {ST: If(Checkbox_RoundUp,RoundUp(Sum(ColshoppingCart,SousTotal)),Sum(ColshoppingCart, SousTotal)) + DonInput} , "Total de la commande: " & Text( ST, "##0.00 #€"))

 

Thanks for your help.

Categories:
  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Hi @GaëlleMAS ,
    Is DonInput a variable or name of the control ?
    Click on "ST" in the formula to chec what value you are getting in SP variable.
    With( {ST: If(Checkbox_RoundUp, RoundUp(Sum(ColshoppingCart,SousTotal)), Sum(ColshoppingCart, SousTotal)) + Value(DonInput) } , "Total de la commande: " & Text( ST, "##0.00 #€"))

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Hi @GaëlleMAS,

     

    How does the code not work? For example, does it give errors / show an incorrect value / give an incorrect format, etc?


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

  • GaëlleMAS Profile Picture
    13 on at

    @NandiniBhagya20  DonInput is a Label, not a Variable and actually this portion is the piece which works fine, the issue looks to be with the RoundUp to make it work and add it to the rest of the Calculation.

     

    GalleMAS_0-1681390843646.png

    @KeithAtherton this is what I'm getting, and the play doesn't even showup I have a Red Cross on my Label.

     

    THanks all for prompt reply

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Thanks. Try changing Checkbox_RoundUp to Checkbox_RoundUp.Value.

    If you get any more errors, continue to hover over them to get more detail.


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

  • GaëlleMAS Profile Picture
    13 on at

    I tried this as well but not working either unfortunately

    GalleMAS_0-1681396029670.png

    I wanted to try to do the RoundUp 1st as a Variable set but the condition is making anything I'm trying to fail, so I guess something is wrong in the way I'm trying to do it.

    If anybody has any other suggestion, please let me know. 

     

    Thanks.

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @GaëlleMAS,

     

    The RoundUp function expects 2 parameters: RoundUp(Number, DecimalPlaces)

     

    If you want a whole number try:

    RoundUp(Sum(ColshoppingCart,SousTotal), 0)

     

    Feel free to adjust the decimal places parameter to your specific needs. You can find the documentation on all of the different Rounding functions here.

     

    I hope this helps!

  • GaëlleMAS Profile Picture
    13 on at

    Hi @LaurensM 

    Thank you very much, I tried so many thing yesterday that I couldn't rember what I've already tried, I'm pretty sure I've tried this as well, but I may have generated other mistake as if wasn't working, now it is !

     

    Thanks very much ! You make my day !

     

     

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
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard