cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tunn
Level: Power Up

How do I make a tally

I'm trying to make a test in powerapps by connecting it to a table in excel. The table would include thress columns, questions, answers and score. Everytime a user inputs the correct value in the text box which equals the corresponding answer tab the score value would be set from "0" to "1". I would then sum all of these values up and show it at the end of the test. How could I implement this in powerapps or is there an easier way to do so?
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How do I make a tally

Hi @Tunn ,

Could you please share a screenshot about your app's configuration?

How do you list your questions from your Excel table? Using Gallery control?

Do you want to sum all score values within your app after the user answered all questions?

 

Based on the needs that you mentioned, I think you need to set up a collection as a data source within your app to collect user's answers. I assume that you added a Gallery control within your app to list all available Questions from your Excel table, is it true?

 

I have made a test on my side, please consider take a try with the following workaround:

Add a Gallery control in your app, set the Items property to following:

'YourExcelTable'

Within the Gallery, add a Label (Label1) to display question, and a Text Box (TextInput1) to collect user's entry. Set the Text property of the Label to following:

ThisItem.Questions

 

Outside the Gallery, add a Label to display the final score value. Set the Text property of the Label to following:

"Final Score Value is: " & Sum(
                                ForAll(
                                        Gallery1.AllItems,
                                        If(
                                           !IsBlank(LookUp('Your Excel Table', Questions = Lbael1.Text && Answers = TextInput1.Text)),
                                           1,
                                           0
                                        )
                                ),
                                Value
)

Please consider take a try with above solution, then check if the issue is solved.

Note: The Questions, Answers represents the column from your Excel table.

 

In addition, I also agree with @datamaster 's thought. You could also consider save your Excel table records into a Collection, then modify your Collection data based on user's entry.

Set the OnStart property of the App to following:

ClearCollect(LocalTable, 'Your Excel Table')

Add a Gallery control, set the Items property to following:

LocalTable

add Label control and a Text Box as above to display question and collect user's entry. Outside the Gallery, add a "Calculate" button, set the OnSelect property to following:

ForAll(
       Gallery1.AllItems,
       If(
           !IsBlank(LookUp(LocalTable, Questions = Label1.Text && Answers = TextInput1.Text)),
           Patch(
                 LocalTable,
                 LookUp(LocalTable, Questions = Label1.Text && Answers = TextInput1.Text),
                 {
                    Score: 1
                 }
           )
       )
)

Add a Label to display the final score value, set the Text property of the Label to following:

"Final Score Value is: " & Sum(LocalTable, Score)

when the user complete the questions, and press the "Calculate" button, the final score would be displayed.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
datamaster
Level 8

Re: How do I make a tally

What you can do is load your data to a collection and then update the record in the collection with the score of 0 or 1. You then do a CountRows(collection,filter(collection,sore=1)) to get your count of correct answers. I wrote a post on how-to-create-a-checklist-in-PowerApps that utilizes this approach. Hope this helps!

 

------------------------------------------------------------------------------OfficePowerUser.com------------------------------------------------------------------------ 
If this post helps answer your question, please click on “Accept as Solution” to help other members. If you thought this post was helpful, please give it a Thumbs Up. 

Tunn
Level: Power Up

Re: How do I make a tally

Im still having trouble checking if the individual text inputs equal to the individual answers corresponding each question to any tips on how i could go about it? 

datamaster
Level 8

Re: How do I make a tally

You can try something like this to compare the answer to the question. You can put this in an onChange event of the text input. control.

If(Lower(ThisItem.Answer)=Lower(ThisItem.Question),updaeif(collection,ID=Thisitem.ID,{Score: 1}),updaeif(collection,ID=Thisitem.ID,{Score: 0})) 

Then you use the method I explained previously.

 

------------------------------------------------------------------------------OfficePowerUser.com------------------------------------------------------------------------
If this post helps answer your question, please click on
“Accept as Solution” to help other members. If you thought this post was helpful, please give it a Thumbs Up.

Community Support Team
Community Support Team

Re: How do I make a tally

Hi @Tunn ,

Could you please share a screenshot about your app's configuration?

How do you list your questions from your Excel table? Using Gallery control?

Do you want to sum all score values within your app after the user answered all questions?

 

Based on the needs that you mentioned, I think you need to set up a collection as a data source within your app to collect user's answers. I assume that you added a Gallery control within your app to list all available Questions from your Excel table, is it true?

 

I have made a test on my side, please consider take a try with the following workaround:

Add a Gallery control in your app, set the Items property to following:

'YourExcelTable'

Within the Gallery, add a Label (Label1) to display question, and a Text Box (TextInput1) to collect user's entry. Set the Text property of the Label to following:

ThisItem.Questions

 

Outside the Gallery, add a Label to display the final score value. Set the Text property of the Label to following:

"Final Score Value is: " & Sum(
                                ForAll(
                                        Gallery1.AllItems,
                                        If(
                                           !IsBlank(LookUp('Your Excel Table', Questions = Lbael1.Text && Answers = TextInput1.Text)),
                                           1,
                                           0
                                        )
                                ),
                                Value
)

Please consider take a try with above solution, then check if the issue is solved.

Note: The Questions, Answers represents the column from your Excel table.

 

In addition, I also agree with @datamaster 's thought. You could also consider save your Excel table records into a Collection, then modify your Collection data based on user's entry.

Set the OnStart property of the App to following:

ClearCollect(LocalTable, 'Your Excel Table')

Add a Gallery control, set the Items property to following:

LocalTable

add Label control and a Text Box as above to display question and collect user's entry. Outside the Gallery, add a "Calculate" button, set the OnSelect property to following:

ForAll(
       Gallery1.AllItems,
       If(
           !IsBlank(LookUp(LocalTable, Questions = Label1.Text && Answers = TextInput1.Text)),
           Patch(
                 LocalTable,
                 LookUp(LocalTable, Questions = Label1.Text && Answers = TextInput1.Text),
                 {
                    Score: 1
                 }
           )
       )
)

Add a Label to display the final score value, set the Text property of the Label to following:

"Final Score Value is: " & Sum(LocalTable, Score)

when the user complete the questions, and press the "Calculate" button, the final score would be displayed.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,783)