web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Scoring Multiple Choic...
Power Apps
Answered

Scoring Multiple Choice Questions

(0) ShareShare
ReportReport
Posted on by 16

Hello!

 

I have a lot of questions and I am still quite new to PowerApps so please bear with me!

 

I’m trying to create a quiz on PowerApps that links to an existing SharePoint list – the quiz needs to mark questions as correct and incorrect on select. I have managed to set up the rules for marking my radio answers and triggering a next button using the following formulas:

 

Radio buttons:

Items:

["NHSI", "YICP", "YICE", "YCUI", "YIMM"]

 

OnSelect:

If(Radio_Answers_2.SelectedText.Value ="YICP",Set(Score,Score+1); UpdateContext({visibleCorrect:true}); UpdateContext({visibleIncorrect:false}),Set(Score,Score);UpdateContext({visibleCorrect:false}); UpdateContext({visibleIncorrect:true}));UpdateContext({RadioDisplay:DisplayMode.Disabled}); UpdateContext({visibleButton:true})

 

Incorrect Label:

Visible: visibleIncorrect

 

Correct Label:

Visible: visibleIncorrect

 

Score:

Text: "Score: " & Score & " / " & NumberQuestions.Text

 

However I am having issues doing a similar thing with my multiple choice questions. I currently have 4 checkboxes and a correct text label with the following formula:

 

Correct Label:

Visible:

Sum(

    [Choice4_Q11.Value And Choice2_Q11.Value],

    If(Value, 1, 0)

)

 

The correct label appears when the two answers are selected but it also shows the answer as correct when all checkboxes are selected or Choice2 and Choice4 are both selected in conjunction with any of the incorrect answers. Is there any way I can control this to only have Correct appear when ONLY those two correct answers are both selected and set up a label for Incorrect to appear if any of the incorrect checkboxes are selected including combinations e.g. (Choice1 only, Choice3 only, both Choice1 and Choice3 including any combinations of that with the correct answers and also if all boxes are selected or blank).

 

I also need to know if I can create a button that can be selected to check the answers before the correct or incorrect labels appear so trainees completing the quiz do not see if the answer is correct or incorrect by selecting and de-selecting checkboxes to gain a point on their score. Essentially I want the trainee to select their checkboxes, then when they’re happy with their answer they can click Check Answers, then find out if it’s correct or incorrect and are unable to change these answers after this.

 

In addition, I’d like to be able to add these answers to an existing SharePoint list, I currently have a button to add to SharePoint for my radio answers but I’m unsure if this would need to be modified for multiple choice. Current formula in place for this button is:

 

OnSelect:

Patch('Skills Assessment', Defaults('Skills Assessment'), {Title: "Skills Assessment", Q1: Radio_Answers_1.SelectedText, Q2: Radio_Answers_2.SelectedText, Q3: Radio_Answers_3.SelectedText, Q4: Radio_Answers_4.SelectedText}); Navigate(FinalScore,ScreenTransition.None)

 

Will I also need to use a different formula to calculate the score?

 

Thanks so much in advance! I know there’s a lot of questions and I really hope I can get some clear answers. If I need to use something other than checkboxes for multiple choice that’s fine but I would just need to know the formula to be able to do so.

Categories:
  • Verified answer
    ArchitectMadhan Profile Picture
    1,584 on at

    Hi @Sazdoug ,

     

    For the Quiz kind of app, you can use the below approach to handle any type of question and answer with ease.

     

    1. Create columns/fields for Question, Answer1, Answer2, Answer3, Answer4 and Correct Answer in Quiz List (SharePoint List). Ex: Question: How many planets are there in the solar system?, Answer1: 3,Answer2: 5, Answer3: 7, Answer4: 8, Correct Answer: 8 (string type field).

    2. Now, in Power Apps create a variable called varRightAnswer as string. 

    3. When the user selects the answer for the quiz, if it is option button then clear the value in varRightAnswer and store the recent value selected in the option button. If it is multi select like checkbox, then you need to append all the selected answers by using "," and store the value in varRightAnswer. Incase if they unselect the answer previously selected, then you need to remove that answer from varRightAnswer Ex: Answer1, Answer2, Answer4

    4. Always compare the List column of CorrectAnswer value with varRightAnswer to show / hide the Correct or Incorrect Label.

     

    If you find my solution helpful for resolving the issue, then please consider Accept it as the solution to help the other members find it more quickly.

  • Sazdoug Profile Picture
    16 on at

    Hello, I managed to get the incorrect/correct for multiple choice to appear by using the following formula on my "Check Answers" button:

    If(
     Choice1_Q11_1.Value = true && Choice2_Q11_1.Value = true && Choice3_Q11_1.Value = true && Choice4_Q11_1.Value = true && Choice5_Q11_1.Value = false && Choice6_Q11_1.Value = false,
     1;
     Set(
     Score,
     Score + 1
     );
     UpdateContext({visibleCorrect: true});
     UpdateContext({visibleIncorrect: false});
     UpdateContext({CheckBoxDisplay:DisplayMode.Disabled});
     UpdateContext({visibleButton: true});
     (Choice1_Q11_1.Value = true || Choice2_Q11_1.Value = true || Choice3_Q11_1.Value = true || Choice4_Q11_1.Value = true || Choice5_Q11_1.Value = false && Choice6_Q11_1.Value = false),
     0;
     Set(
     Score,
     Score
     );
     UpdateContext({visibleCorrect: false});
     UpdateContext({visibleIncorrect: true});
     UpdateContext({CheckBoxDisplay:DisplayMode.Disabled});
     UpdateContext({visibleButton: true});
     Choice5_Q11_1.Value = true || Choice6_Q11_1.Value = true,
     0;
     Set(
     Score,
     Score
     );
     UpdateContext({visibleCorrect: false});
     UpdateContext({visibleIncorrect: true});
     UpdateContext({visibleButton: true});
     UpdateContext({CheckBoxDisplay:DisplayMode.Disabled})
    )

    When choice 1,2,3,4 were selected (correct answers), this updated my score to 1. If any of the incorrect answers were selected such as all text boxes, this would not add any points to the score:

    FunctionalMultiChoiceCorrect.jpgFunctionalMultiChoiceIncorrect.jpg

     

    My first question screen has the following OnVisible code: 

    UpdateContext({visibleCorrect: false});
    UpdateContext({visibleIncorrect: false});
    UpdateContext({RadioDisplay: DisplayMode.Edit});
    UpdateContext({visibleButton: false});
    Set(
     Score,
     0
    );
    Reset(Radio_Answers_1);

    And every following question has the same OnVisible code but the score was Set(Score,Score);

    This tallied up fine on my test app and worked with numerous multiple choice questions as well as radio questions.

     

    However, now I've created a final product using the same formulas it is not tallying the scores up correctly and I am getting the following errors for all screens: 

     

    OnVisible ScoreError.jpg

    Code: 

    UpdateContext({visibleCorrect:false});UpdateContext({visibleIncorrect:false});UpdateContext({CheckBoxDisplay:DisplayMode.Edit});UpdateContext({visibleButton:false});Reset(Choice1_Q1);Reset(Choice2_Q1);Reset(Choice3_Q1);Reset(Choice4_Q1);Reset(Choice5_Q1); Set(Score,0)

     

    OnSelectCheckAnswersError.jpg

    Code:

    If(
     Choice1_Q1.Value = false && Choice2_Q1.Value = true && Choice3_Q1.Value = true && Choice4_Q1.Value = false && Choice5_Q1.Value = false,
     1;
     Set(
     Score,
     Score + 1
     );
     UpdateContext({visibleCorrect: true});
     UpdateContext({visibleIncorrect: false});
     UpdateContext({CheckBoxDisplay:DisplayMode.Disabled});
     UpdateContext({visibleButton: true});
     (Choice1_Q1.Value = false || Choice2_Q1.Value = true || Choice3_Q1.Value = true || Choice4_Q1.Value = false || Choice5_Q1.Value = false),
     0;
     Set(
     Score,
     Score
     );
     UpdateContext({visibleCorrect: false});
     UpdateContext({visibleIncorrect: true});
     UpdateContext({CheckBoxDisplay:DisplayMode.Disabled});
     UpdateContext({visibleButton: true});
     Choice1_Q1.Value = true || Choice4_Q1.Value = true || Choice5_Q1.Value = true,
     0;
     Set(
     Score,
     Score
     );
     UpdateContext({visibleCorrect: false});
     UpdateContext({visibleIncorrect: true});
     UpdateContext({visibleButton: true});
     UpdateContext({CheckBoxDisplay:DisplayMode.Disabled})
    )

     

    I'm not sure what I'm doing wrong 😞 there are more questions than the original test (was 11 questions and now it's 30) - do you have any ideas on how I can fix this score? Does anything look incorrect in my formulas?? 

     

    Thanks so much for your help. 

  • ArchitectMadhan Profile Picture
    1,584 on at

    Hi @Sazdoug ,

     

    The approach you follow right now is tedious, Because you are creating new screen for each question. But if you follow my approach. You can load the questions dynamically in One screen. In future if you want to add / modify few more quiz questions you don't need to do any change in the screens. In the whole app you might need to have only 3-4 screens that includes landing screen or Home screen, Quiz type selection screen, Error Message Screen and Feedback screen.

     

    Re: Scoring Multiple Choice Questions - Power Platform Community (microsoft.com)

    If you find my solution helpful for resolving the issue, then please consider Accept it as the solution to help the other members find it more quickly.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 350 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 318

#3
Mohsin Ali Profile Picture

Mohsin Ali 220

Last 30 days Overall leaderboard