Calculate Average with number analysis

1. What is the problem? Please be detailed.

  • I have a question that contains 10 integer variables, I need to do a calculation that excludes the largest number and the smallest number among these 10 variables and take the average of the remaining 8. I was only able to find the calculation of the average of all variables, but first I have to exclude the largest and smallest values ​​entered by the user.

two. What steps can we take to reproduce this issue?
-create 10 entries with an integer variable and display the average in another grade-type question

3. What have you tried to resolve the issue?

  • I managed this part which is taking the average of the 10 variables.
    "
    (${firstReading}+${secondReading}+${thirdReading}+${fourthReading}+${fifthReading}+${sixthReading}+${seventhReading}+${eighthReading}+${ninthReading}+${tenthReading} ) division 10
    "
    4. Upload any forms or screenshots you can share publicly below.

#the content of the image is in Portuguese

Are these simple questions or inside a repeat?

You may try the following example, please. Average_Stripped01.xlsx (12.3 KB)
This solution would need adaption if not all (10) readings are required (= yes).

Hints:
- Instead of a note, you might also use a read_only field (see at the end).
- For the used functions, see https://getodk.github.io/xforms-spec/#fn:Number-Functions.
- The division operator is named div. (See https://getodk.github.io/xforms-spec/#xpath-operators).
- To facilitate support, it is preferable to share a related extract as XLSForm file, please.

1 Like

I would really like to thank you for sharing your knowledge, it was very useful to me, it will help me a lot with what I need.
I saw that you informed that if it is not mandatory to enter all the numbers in the average calculation, for example: if the user entered only 5 numbers, or 7 numbers, what should change?