Increment score based on responses using Power Automate




I have created a form using Microsoft Forms that asks a user a few questions. I am using power automate to assign a value to each response based on what the user selects, and at the end, once they submit the form the score is accumulated and stored in a sharepoint list. The problem is, each answer has a different score attributed to it, and it does not seem to be adding them correctly. To make the flow easier, I made conditions based on the points (1-5), as shown below as an example: 



I am also attaching the scoring formula I am intending on using:


The problem as stated is that the scores never add up correctly. If I am selecting more than one three point question in different sections or even the same, it doesn't add it all and I instead get a lower score than I should be. I don't want to have to create a bunch of conditions (that seems to be the only solution) so is there something wrong with the logic or is there an alternative?


Thanks in advance.


1 Reply
best response confirmed by hs1ngh (Visitor)

@hs1ngh your condition won't work because it will apply the increment of 3 points only once if it finds that any of the multi choice answers have been selected. It doesn't loop through them and add it each time an answer has been selected. So  the user might select 3 answers but it will only add 3 points. 


But you can get it to work very well using a combination of a Switch control for the single answer questions and a condition for each of the multiple answers. The example shown below uses your scoring and it only took about 15 minutes to build the form, the flow and the list.


The overall flow looks like this:






This example uses your questions and scoring method. First is the form:


etc etc


Looking at the flow in detail there is the trigger, the get response details action and we've initialized the variable as a float to hold the score:




Question 1 only has a single choice. So you can use a Switch control which is a type of condition that looks at the question and in case it equals IT for example then increment the variable by 4, in case the answer equals Cyber then increment the variable by 5  and so on.




But question 2 is a multi choice question so you can't use a switch control. Instead, add a condition and if the question contains Passion then increment the variable by 3. You can copy the condition to your clipboard and use it for each of the other possible answers, changing the right hand box and the increment value as appropriate.




The same applies to Question 3 which also allows multiple answers:




Question 4 is  a single answert question so again you can use a switch control.




And the same with Question 5:




Finally, add the create item action and select the variable for the total and the text for question 6. I haven't dealt with the uploaded file in this example as your main concern was the total value.




The form was completed and the flow ran successfully & quickly and recorded the correct overall points total in the list.




Come back with any questions about this.


Los Gallardos
Microsoft Power Automate Community Super User