Hey everyone,
I'm new to PowerApps and I'm finding it a bit of a steep learning curve despite all the excellent videos I've found online.
Trying to make a page with a list of 10 questions on it using a text label for the question itself and a dropdown for Yes,No or N/A to select an answer.
I'd like to be able to give each a question a weighting as some are more important than others too.
Once it's complete (and taking the N/As into account) I want to display the overall score in a label on the same page.
I have the 10 dropdowns setup and working and can get one of the answers into the score label using something like:
If(dropdownQ1.Selected.Value = "YES", set (score,10), set(score,0))
But, how so I add up the score and, more importantly, weight the answers to get an overall % score at the end.
Any help very much appreciated 😉
Solved! Go to Solution.
Hi @Bub ,
I did a demo for you.
I use 3 dropdown controls(Dropdown1,Dropdown1_1,Dropdown1_2) and create 3 variables (Var1,Var2,Var3).
The scores for each question are: 200, 100, 50.
Set 3 dropdown controls' Items property to:
["NA","Yes","No"]
["NA","Yes","No"]
["NA","Yes","No"]
Set 3 dropdown controls' onchange property to:
If(Dropdown1.Selected.Value="Yes",Set(Var1,200),Dropdown1.Selected.Value="No",Set(Var1,0),Set(Var1,Blank()))
If(Dropdown1_1.Selected.Value="Yes",Set(Var2,100),Dropdown1_1.Selected.Value="No",Set(Var2,0),Set(Var2,Blank()))
If(Dropdown1_2.Selected.Value="Yes",Set(Var3,50),Dropdown1_2.Selected.Value="No",Set(Var3,0),Set(Var3,Blank()))
Add a label control and set its Text property to:
(Var1+Var2+Var3)/(3-If(Var1=Blank(),1,0)-If(Var2=Blank(),1,0)-If(Var3=Blank(),1,0))
The result is as follows:
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
Hi @Bub ,
The easiest way is to set a variable for each dropdown control.
Finally, you only need to use a similar formula in the label:
Var1+Var2+Var3...
Var1/(Var1+Var2...)
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
Thank you @v-xiaochen-msft .
So, I put this in the dropdown : ["YES", "NO", "N/A"]
Then I put this in the dropdown 'on change': UpdateContext({FQ1: f_dropdownQ1.Selected.Value})
This should give me the result of the selection in FQ1 context variable.
I repeat for each of the 10 questions updating the formula accordingly.
Somewhere else, in a label I need to do something with the 10 variables I have now created.
They might be Yes, No or N/A. I need to know how many N/As there are as these need to be removed from the score calculation. Then I need a 'score' for each yes or a 0 for each no.
Scoring as follows:
e.g.
5 YES / 5 NO = 50%
6 YES / 4 NO = 60%
3 YES / 6 NO / 1 NA = 33% (3 out of 9)
However, I want to weight the answers as some are much more important than others.
If Q1 = Yes then it's worth 100 points
If Q2 = Yes then it's worth 200 points
etc.
I'm totally stuck / confused ;-(((
Hi @Bub ,
I did a demo for you.
I use 3 dropdown controls(Dropdown1,Dropdown1_1,Dropdown1_2) and create 3 variables (Var1,Var2,Var3).
The scores for each question are: 200, 100, 50.
Set 3 dropdown controls' Items property to:
["NA","Yes","No"]
["NA","Yes","No"]
["NA","Yes","No"]
Set 3 dropdown controls' onchange property to:
If(Dropdown1.Selected.Value="Yes",Set(Var1,200),Dropdown1.Selected.Value="No",Set(Var1,0),Set(Var1,Blank()))
If(Dropdown1_1.Selected.Value="Yes",Set(Var2,100),Dropdown1_1.Selected.Value="No",Set(Var2,0),Set(Var2,Blank()))
If(Dropdown1_2.Selected.Value="Yes",Set(Var3,50),Dropdown1_2.Selected.Value="No",Set(Var3,0),Set(Var3,Blank()))
Add a label control and set its Text property to:
(Var1+Var2+Var3)/(3-If(Var1=Blank(),1,0)-If(Var2=Blank(),1,0)-If(Var3=Blank(),1,0))
The result is as follows:
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
Oh, wow. Thank you so much @v-xiaochen-msft for taking the time to help me. I've spent absolutely ages on this without success until now.
It works perfectly.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
190 | |
57 | |
43 | |
36 | |
34 |
User | Count |
---|---|
270 | |
78 | |
75 | |
74 | |
67 |