Answered

Benefit calculation


Userlevel 1
Badge

I have a form for housing applicants. I ask them, in a multiple choice question, which state benefits they receive. Then I’d like to be able to ask them how much they receive for each of the benefits that they have ticked and whether the amounts they have enter are weekly or monthly (I suppose I could stipulate that they enter either weekly or monthly). So this question should ideally list just the ticked benefits and have a text box against each to enter the amount and a drop down against each to indicate either weekly or monthly. Then I’d like to calculate the total amount of benefits, but I think that’s probably the easy bit.

icon

Best answer by john.desborough 16 February 2023, 00:41

View original

13 replies

Userlevel 7
Badge +5

Hi @johnt Happy Valentine’s Day! Just to be sure I understand this correctly, are you basically calculating the timeframe in which they receive benefits times the amount in benefits they receive? 

Userlevel 1
Badge

Hi Liz. Thanks for your reply. The problem is that some benefits are paid weekly, some four-weekly (I’ve been reminded) and some monthly. So we need to know which of the 17 benefits (or salary) they are receiving, the frequency of each of the payments and the amount paid each time. Then we’ll be able to calculate their total income. Hope this is clear.

Userlevel 7
Badge +5

Hi @johnt Is my test form below something similar to what you’re looking for? In my example, I added 10 points automatically for health, in case you’re wondering where that calculation is coming from. 

 

 

If this is what you’re looking for, I can create a video on how I made this form. 

Userlevel 1
Badge

Hi Liz, thanks for the test form. The problem I have is extrapolating from simpler examples to the more complicated situation I have. Let me try to explain. For example, if someone says, in answer to the multiple choice question, that they receive benefits #3, #7 and #10, then I need to direct them to a question that asks them how much they receive for benefit #3 (as in your test form), then I need to direct them to the next question - how much they receive for #7 etc, then the same question for #10. I’m not sure how to structure this. I’ve tried doing this sequentially. i.e. in an introduction to this section I set up the logic to ask if they have ticked #1 in the MCQ? If they have, then direct them to a question about how much for #1. If they didn’t tick #1 in the MCQ, then direct them to the question about #2. Then in the question about #2, I ask them if they ticked #2 in the MCQ. If their answer is no, I direct them to the question about #3, and so on. This didn’t work - questions for all 17 benefits opened because, of course, the question is opened before the logic applies. So I’ve wondered if looping back to the introduction might work, i.e. in the introduction question, ask if each of the 17 boxes has been ticked and if they have, direct them to the question about that particular benefit. Then, when a particular benefit question, e.g. #3 has been answered, loop back to introduction question to check #4 and so on. Of course, I would need to include a way to prevent them being stuck in a loop between the introduction and #3. 

Trying to explain logic is as hard as trying to do it! And I’ve been going round and round in circles with this.

I would be very grateful for your advice.

Thanks

John

Userlevel 7
Badge +5

Hi @johnt Oh I see. This would definitely be a lot of logic jumps to setup, but it’s possible. You’d have to use the solution here to set up the jumps so only the relevant ones apply, but that would also require asking the same question multiple times because you can’t loop back in the form. 

@john.desborough have you setup a solution like this for a client before? 

Userlevel 1
Badge

Hi Liz, thanks for your reply. You’re right! Loop backs don’t work - it does get stuck in a loop between the introduction page and the first ticked benefit, and there’s no way out. I’ll have a look at the link you provided.

Thanks

John

Userlevel 7
Badge +6

@johnt - in your example, once the user has selected the items (ie the three you mention) you can lead into the followup questions using logic like this:

  • assuming that they select the benefit on q1:
    • if q1 = 1 then go to q2 (assumed follow up for selecting benefit 1)
    • if q1 = 2 then go to q3 (.. for selecting benefit 2) 
    • etc..
    • if q1=10 then go to q11….
    • otherwise go to ending/anothe rpage
  • depending on which benefit they selected first, this approach allows you to walk down the list and start the followups at the ‘earliest point’
  • logic on q2 (if someone has chose benefit one and there is only this 1 follow up - if there are more put this logic on q2 or the last question in the benefit 1 series)
    • if q1=2 then go to q3
    • if q1=3 then go to q4
    • ...
    • if q1=10 then go to q11
    • otherwise go to ending/another page
  • note the declining number of logic rules on this one - you’ve already selected benefit 1 (this question) so now we looked at if they chose another benefit on q1 and go to that page
  • on q3 (choosing benefit 2) you would have
    • if q1=3 then go to ….
    • 1f q1=4 then …
    • ….
    • if q1=10 then go to 
    • otherwise take a hike (kidding) 

repeat this process for all of the potential benefits - when you get to q11 for someone selecting benefit 10, you would send them to the ending or another page cuz there ain't no place else to go.. 

this avoids the loop back and keeps you in a logical flow through the quiz

 

hope that helps

 

des

Userlevel 1
Badge

Thanks @john.desborough and Liz. As I said, it was the structure of the logic I was struggling with. With the example you pointed me to Liz, and your explanation John, I now understand the approach and I have just done all the rules for all the benefits. And it works! Now to work out how to calculate total income from a combination of weekly, monthly and four-weekly payments :-)

Thanks for your help.

John

Userlevel 7
Badge +6

@johnt - good to hear.. i think the easiest way is to create a series of variables that allow you to hold the base values and then multiply the variable by the constant ie if the user chooses weekly, here’s an approach:

  • if q1 is greater than 0 (ie the amount they were paid) then add q1 to v_amount (i made up the variable name here on the fly)
  • if period = weekly multiply v_amount by 52 (for the annual amount) - don’t want to change the answer from q1 by multiplying IT by 52
  • if period = monthly multiply v_amount by 12 
  • if period = 4-weekly multiply v_amount by 13
  • if v_amount is greater than 0 add v_amount to v_total 

do something similar for all the benefits ie create an amount for each one (v_amount1, v_amount2...) .. and add it to the v_total 

that should do the trick.. if it does, head to the coffee shop and pay for someone’s coffee as a treat … or see if you can pay for a suspended coffee… 

 

cheers

 

des

 

Userlevel 7
Badge +5

Hi @johnt Woohoo!! Glad to hear that’s working!! 

Userlevel 1
Badge

@john.desborough Thanks for your suggestion about the calculations. I did something very similar before I saw your reply. I created three variables - @week, @month and @four_week. Then went through the benefits and if one was weekly benefit it was added to @week, monthly to @month and four-weekly to @four_week. Then I multiplied @week by 4.33, @four_week by 1.08 and added the totals to @month to give a monthly income, @score.

Off to the coffee shop.

Userlevel 7
Badge +6

@johnt - well done!!  

 

cheers

 

des

Userlevel 7
Badge +5

Yes! Get that coffee, @johnt ! You deserve it. Glad to hear @john.desborough ‘s suggestions worked. 😀

Reply