# Long calculations in Bubble

**URL:** <https://forum.bubble.io/t/long-calculations-in-bubble/323851>\
**Category:** Questions\
**Created:** [May 24, 2024, 4:57pm UTC](https://forum.bubble.io/t/long-calculations-in-bubble/323851 "2024-05-24T16:57:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![towns.agnew](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@towns.agnew](https://forum.bubble.io/u/towns.agnew)\
**Post date:** [May 24, 2024, 4:57pm UTC](https://forum.bubble.io/t/long-calculations-in-bubble/323851/1 "2024-05-24T16:57:05Z")

</div>

I am setting up a simple calculator in my app. Users will enter their inputs in the fields under “Trip Details.” The app then calculates the subtotals for “Driver Pay,” “Fuel Cost,” “Trip Reserve,” and “Markup.”

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/6/6/66acc9f6b4c9582dbc2616d0e8eddaae442960d0.png)

Using the formula editor I run into two issues that I cannot seem to find a solution to:

1. The “Breakeven” subtotal does not seem to follow Bubble’s left to right schema for calculations and I keep returning too high of a value.

![image](https://us1.discourse-cdn.com/bubble/original/3X/6/8/68b78239921db6d0a1ef50dc2127152c36dd4646.png)

1. Ideally I could calculate a grand total, but until I can figure out issue #1, I do not know how to get this ultimate answer.

Thank you, and I appreciate any help the community can provide. I am more than happy to provide clarifications or additional data/screenshots if needed.

---

<div class="post-metadata">

**Author:** ![tylerboodman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/tylerboodman/32/242142_2.png) [@tylerboodman](https://forum.bubble.io/u/tylerboodman)\
**Post date:** [May 24, 2024, 5:10pm UTC](https://forum.bubble.io/t/long-calculations-in-bubble/323851/2 "2024-05-24T17:10:03Z")

</div>

If you go to App settings → Versions tab → at the bottom is you can enable the Parenthesis feature, that will save you a lot of headache on what exactly their order of operations is doing

---

<div class="post-metadata">

**Author:** ![towns.agnew](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@towns.agnew](https://forum.bubble.io/u/towns.agnew)\
**Post date:** [May 24, 2024, 5:37pm UTC](https://forum.bubble.io/t/long-calculations-in-bubble/323851/3 "2024-05-24T17:37:49Z")

</div>

is there a way to force where the parentheses are added if the editor inserts them incorrectly?

---

<div class="post-metadata">

**Author:** ![tylerboodman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/tylerboodman/32/242142_2.png) [@tylerboodman](https://forum.bubble.io/u/tylerboodman)\
**Post date:** [May 24, 2024, 5:42pm UTC](https://forum.bubble.io/t/long-calculations-in-bubble/323851/4 "2024-05-24T17:42:21Z")

</div>

Yes once you enable it you might need to rebuild the expression a little bit, but the way you do it is as you build from left to right you click **More…** in the spot you want inside or outside the parenthesis

---

<div class="post-metadata">

**Author:** ![towns.agnew](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@towns.agnew](https://forum.bubble.io/u/towns.agnew)\
**Post date:** [May 24, 2024, 5:51pm UTC](https://forum.bubble.io/t/long-calculations-in-bubble/323851/5 "2024-05-24T17:51:14Z")

</div>

With parentheses, the expression evaluates to three separate calcs…clearly I am not getting something that should be straighforward!

![image](https://us1.discourse-cdn.com/bubble/original/3X/c/6/c6ad006035eba09d5b2c1af6a6c16cb93a4ee04f.png)

---

<div class="post-metadata">

**Author:** ![tylerboodman](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/tylerboodman/32/242142_2.png) [@tylerboodman](https://forum.bubble.io/u/tylerboodman)\
**Post date:** [May 24, 2024, 6:06pm UTC](https://forum.bubble.io/t/long-calculations-in-bubble/323851/6 "2024-05-24T18:06:21Z")

</div>

I’m confused what I’m looking at 😂 It looks like 3 separate calculations you are doing with the () and + manually typed out.

What I mean is the blue expression you screenshotted earlier, it will let you click **More** in certain spots to force the values either inside or outside parenthesis. You don’t type ( ) or +, it puts ( ) automatically and you would pick + from the operator options. I’m not gonna say this is intuitive how they have us doing it but it does make sense after a while… 🤣

---

<div class="post-metadata">

**Author:** ![towns.agnew](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@towns.agnew](https://forum.bubble.io/u/towns.agnew)\
**Post date:** [May 24, 2024, 6:30pm UTC](https://forum.bubble.io/t/long-calculations-in-bubble/323851/7 "2024-05-24T18:30:54Z")

</div>

Finally got it. Definitely not intuitive at first, but makes sense once you see the pattern and learn exactly where to click. Thanks for the help!
