cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ianallen13V2
Helper II
Helper II

List values for end score

Hello, 

 

I am building an app where I will have about 9 drop downs, each with the same fields: YES, NO, N/A and I want them to be weighed/valued the same as: 

YES = 1

NO = 0

N/A = No value

 

Then I need to figure out a way to have a 'score' field tally up the total from all 9 drop downs to give me a composite score (and then ultimately a percentage).  I'm sure this is possible, but I am not sure how to start this.  

 

Any guidance or support is appreciated. 

 

Thank you

 

1 ACCEPTED SOLUTION

Accepted Solutions
TheRobRush
Super User
Super User

Here's one way, of many.

 

I made 9 dropdowns, each with items of ["YES", "NO", "N/A"]

 

each ones onchange had the following code

Switch(q1.Selected.Value,
"YES",Set(PointCount1,1);Set(TotalCount1,1),
"NO",Set(PointCount1,0);Set(TotalCount1,1),
"N/A",Set(PointCount1,0);Set(TotalCount1,0));

Set(RunningScore, Sum(PointCount1,PointCount2,PointCount3,PointCount4,PointCount5,PointCount6,PointCount7,PointCount8,PointCount9));
Set(RunnignQuestionCount, Sum(TotalCount1,TotalCount2,TotalCount3,TotalCount4,TotalCount5,TotalCount6,TotalCount7,TotalCount8,TotalCount9))

 (except the 1 becomes 2 3 4 5 6 7 8 9 respectively for each subsequent dropdown so they each have and maintain their own individual counts)

 

next to them i have 3 labels, text of each is below

 

"Total Yes: "&RunningScore

 

"Total Questions: "&RunnignQuestionCount

 

"Score: "&RoundDown(RunningScore/RunnignQuestionCount*100,0)&"%"
_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

View solution in original post

7 REPLIES 7
TheRobRush
Super User
Super User

Here's one way, of many.

 

I made 9 dropdowns, each with items of ["YES", "NO", "N/A"]

 

each ones onchange had the following code

Switch(q1.Selected.Value,
"YES",Set(PointCount1,1);Set(TotalCount1,1),
"NO",Set(PointCount1,0);Set(TotalCount1,1),
"N/A",Set(PointCount1,0);Set(TotalCount1,0));

Set(RunningScore, Sum(PointCount1,PointCount2,PointCount3,PointCount4,PointCount5,PointCount6,PointCount7,PointCount8,PointCount9));
Set(RunnignQuestionCount, Sum(TotalCount1,TotalCount2,TotalCount3,TotalCount4,TotalCount5,TotalCount6,TotalCount7,TotalCount8,TotalCount9))

 (except the 1 becomes 2 3 4 5 6 7 8 9 respectively for each subsequent dropdown so they each have and maintain their own individual counts)

 

next to them i have 3 labels, text of each is below

 

"Total Yes: "&RunningScore

 

"Total Questions: "&RunnignQuestionCount

 

"Score: "&RoundDown(RunningScore/RunnignQuestionCount*100,0)&"%"
_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

Hey Rob, 

 

Thank you so much!  I appreciate the detailed response.  I do have some questions as I may need this broken down a bit for me.   Would you be able to share more of your setup as I think it would be easier for me to understand if it were broken up and simplified.  

 

For example, I wasn't sure what 'q1' was in the 'onchange' part (I assume question 1, but wasn't sure how that fit). 

 

Just any additional guidance is appreciated. 

 

Thank you again

 

Rob - I should have waited for the coffee to set in.  I applied it and that works perfectly!  Thank you so much!  I may need to reach back out as I go further here, but so far I think this will work for what I need. 

 

Thank you again! 

Question: 

ianallen13V2_0-1634140669296.png

 

This works great, but I want it with just the percentage.  I tried to remove the 'Total' but then it does not work.  Is there a way to have a field just yield the percentage and not "total: 100%"? 

 

Thank you! 

TheRobRush
Super User
Super User

remove the total: bit, and also the & after it

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!
karlovak
Regular Visitor

I have the exact same task to complete, but getting an error in "On change" for whatever reason. Q1 is your data card value, correct?
ianallen13V2
Helper II
Helper II

Sorry, I'm not 100% sure of your question - but this solution worked for me. 

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (4,458)