Answered

Multi-step calculations


Badge

Hi All, 

I have a simple four question survey, but the result relies on multi-step calculations at the end, before providing two results. I’ve made custom variables for each factor, but at times two variables equal a third needed in a later calculation step, which is the bit I can’t seem to make possible. Here’s the current math:

Q3 x Q4 = CustVariable2

Q3 - CustVariable2 = CustVariable3

CustomVariable3 / Q2 = CustVariable4

Q3 / CustVariable4 = CustVariable5

Result 1 = CustVariable5 - Q2

Result 2 = CustVariable5 x Q1

Any help would be greatly appreciated!

icon

Best answer by john.desborough 6 August 2021, 05:14

View original

11 replies

Userlevel 7
Badge +5

Hi @EvoKneevo Happy Thursday! Thanks for stopping by the community. I’m the absolute worst at math, so I’m going to see if @john.desborough happens to know the answer to this! I believe you can do everything up until the very last piece subtracting the variable minus the question, but hoping to see if Des happens to know!

Userlevel 7
Badge +6

@Liz @EvoKneevo - looking at this now but will have to revert later this afternoon eastern time. 

@EvoKneevo  - can you provide me a range of possible values for q1-q4 so that i can run a test? the voices in my head are trying to figure out the appropriate range values with with to work

 

ok.. try this: my test 

i made it work with a range of values that seemed to make sense to me.. have a look at it and try out some of the calculations in the range and let me know if the logic works - voices 3,4 and 5 in my head say it works but they also like 8 coffees a day… 

i will share the logic for it if it works. 

des

Userlevel 7
Badge +5

Thank you, @john.desborough !

 

Userlevel 7
Badge +6

 

Badge

That’s amazing @john.desborough - your thought on making a range has me spinning off in other variable directions. So overnight we’ve had to change the calculation (sigh) BUT the fact you can calculate two things to equal a variable, makes me breathe a sigh of relief - as that is still very much needed. Here’s the nitty gritty of what we are trying to do, with example data:

Q1: How much does that thing cost? A: $1250

Q2: How many of those things do you want? A: 825

Q3: How much of that thing, at that price, are you currently paying for? A: 52%

Q4: (Variable determined by choices = between 0.1 to 0.6) A: 0.6

Result: New % of that thing that you would now pay if you signed up with X: 83% 

Back end math:
Q2 x Q1 = $E
(100- Q3) / 100 = 0.F
E * F = $G
(1-Q4)*G = $H
(E - H) / E = RESULT %

If I could give you a 9th coffee, I would!! 

Userlevel 7
Badge +6

@EvoKneevo - sounds like fun.. and probably someone will say to change it again tomorrow.. 

i have not redone the test to reflect your calculations above BUT i have done screen caps of the logic that i did for the version i had created earlier. i will let you figure out the changes necessary to reflect your updates. (too much olympics and so little sleep lol)

hopefully these will help:

des

Badge

Thanks @john.desborough! I’ve just noticed in testing that calculations seem to fire from the first question, rather than in an order. This means I can’t copy a subtotal into different variables and then work with those variables individually e.g. I “add” var1 (which is a person’s answer) to var2 and var3, so they are all equal, but then in using var1 in another calculation, var2 and var3 switch to match the new amount in var1 because of the earlier comand to add var1. Make sense?

Does this mean that you can only do “pass-the-parcel” calculations? So you plan the math out backwards and put it all in at the end? 

And if I wanted to copy a variable at one point to use at a later point inh the calculations is that possible?

Thanks! Sorry for the questions, I’m the pointy end of the stick in making this happen!

Userlevel 7
Badge +6

@EvoKneevo - the calculations are NOT all on the first question: i used q1 as the ‘existence’ part of the logic because it was easy to use. you can use whatever is appropriate to initiate a logic rule 

you will need to work through your question flow and where and when the logic is applied in your flow. I simply showed an example that was easy to build in about 15 minutes 

the one thing to keep in mind is that any calculation you do on a variable ie adding a number of parts to the variable in one question is going to be carried through the entire question set - you might need to create several more variables to do what you need to do. (in a recent project for a client, there were 12 categories, over 4,200 logic rules to be created and over 40 variables used in calculations.)

 

Badge

@john.desborough I am pleased to report that I conquered the logic!! I did the entire thing from the second-to-last question BACKWARDS, with fewer variables - just tracking one variable through mutiple equations, copying it once. The key gamechanger came in creating IF statements that truly did depend on the outcome of the last calculation. This meant my order of math changed and variables dropped. It’s 22 steps and uses 9 variables (some of which are pre-populated numbers). I think this is my work achievement of the year! Thankyou so much for your help :nerd::hugging:

Userlevel 7
Badge +6

@EvoKneevo - glad to hear… now pay it forward by checking in here in the community from time to time and sharing your knowledge and success! 

 

cheers

the vacating des

Userlevel 7
Badge +5

I’m late to the party, but yay!! Glad to hear you got this working, @EvoKneevo and thanks for the help, @john.desborough !

Reply