spa.sc
1
I have a table of Services performed and an option set of Service Type. Performed services are billed according to the time spent and their type unit price. For example a Hair Cut is billed 20$/h and a Nail Design 15$/h.
When I display a table with all performed services, and I need to calculate the total for all services. For that I use a form input with the following formula in the Input field:
Sum of hours of Hair Cut x Unit Price of Hair Cut + Sum of hours of Nail Design x Unit Price of Nail Design
But Bubble doesn’t respect the normal order of calculation. It does:
((Sum of hours of Hair Cut x Unit Price of Hair Cut) + Sum of hours of Nail Design) x Unit Price of Nail Design
Example:
I did 3 hours of Hair Cut, and 3 of Nail Design
Unit Price of Hair Cut is 20$, and of Nail Design is 15$
So total should be 3 x 20 + 3 x 15 = 105$
But for Bubble it’s ((3x 20) + 3) x 15 = 945$
See print screen.
Bubble calculates from left to right, unless you enable the parentheses feature in Settings → Versions → Experimental features
spa.sc
3
This is the solution. But the editor is really tricky to use. Thanks
I have also found using “arbitrary text converted to number” works great as an easy way to divide complex formulas, makes it easier to edit down the line as well
1 Like
system
Closed
6
This topic was automatically closed after 14 days. New replies are no longer allowed.