COUNT() number of attemps

Hi All, I’m creating an app which allows users to answer a quiz. To do this I have a quiz table where users enter there results. I want one column to count the which attempt the user is on. For example if they are doing the test for the third time then the attempt column should be 3.

To differentiate users I have created a table which assigns each USEREMAIL() a unique ID to track them (I’m not using USERMAIL() directly to track attempts as I don’t want records to show the users email with there test results)

This means I have my user table and my quiz Table.

User Table fields:
User ID
User Email

Quiz Table Fields:
User ID (Reference to User Table)
Attempt Number

I know i need to use the COUNT() function but I’m not sure how to specify the User ID that want to count.

Thanks
Tim

Solved Solved
0 3 121
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

View solution in original post

3 REPLIES 3

Hello Tim,

With this one you stumped me a bit. If I understand you correctly each time a user takes the quiz, you get a new row in the Quiz Table. I recommend taking the attempt number and moving it to the user table instead. If that is done you could use an expression that counts any time that the user ID matches the users email. Also make sure your QUIZ table has a unique ID in addition to the reference you already have stated. You could have a SELECT() function nested inside a COUNT() function. Such as:

COUNT(SELECT(Quiz Table[ID], Quiz Table[User ID].[User Email]=[_THISROW].[User Email]))

The select portion returns a list of IDs where the User ID’s email matches the email from the user table. Then the count function tells how many times that happened. This could be a formula for the attempt number.

While you are building an app I encourage you to utilize some resources such as the AppSheet documentation (I have linked some below just so you can easily access it) and you can go to appsheettraining.com which is a website my company owns, we have some free videos that helps with some of the things you are looking for.

Craig
QREW Technologies

SELECT()
COUNT()
Dereference Expression

Thanks for the advise. I have been using documentation, videos as well as this community to learn where i can but was still running into a couple issues. As for this problem I realised a simpler way to do this and my idea was actually unnecessary. Thanks for the advise though and it may come in useful for a different idea I have.

Tim

Steve
Platinum 4
Platinum 4
Top Labels in this Space