Question: How to sum all the scores, which is a select type, and divide to get the average? if select NA is not to be calculated.
For Example, I have 3 table lines the option I select is 1,0.5 and NA.
so,
Total = 1.5
Average = total / 2 table lines (exclude NA line)
= 1.5/2
= 0.75
Calculate Total Using Select Type
Let me show you how to do it in the Automation block.
-
Go to the Default form
-
Open and Scroll all the way and Click Add Automation
-
Drag & Drop For block
-
Input #Form#Table
-
Input item under each
-
Drag & Drop Condition block
-
Input #item#Attendance =='0.5’
#item#Attendance =='0.5' is True
-
Drag & Drop Action block
-
Click +Add Action
-
Select Set
-
Variable: Input #item
Value:
* Click Expand Property
* Select Total = 0.5 -
Click +Add Action
-
Select Set
-
Variable: #Form #Total
Value: sum(#Form#Table#Total)
#item#Attendance =='0.5' is False
- Drag & Drop Condition block
- Input #item#Attendance =='1’
#item#Attendance =='1' is True
-
Drag & Drop Action block
-
Click +Add Action
-
Select Set
-
Variable: Input #item
Value:
* Click Expand Property
* Select Total = 1 -
Click +Add Action
-
Select Set
-
Variable: #Form #Total
Value: sum(#Form#Table#Total)
#item#Attendance =='1' is False
-
Drag & Drop Action block
-
Click +Add Action
-
Select Set
-
Variable: Input #item
Value:
* Click Expand Property
* Select Total = 0
Output to calculate Total from Select Type
Calculate Average without N/A line
- Drag & Drop Condition block from the Start
- Input #Form#Table.Count>0
#Form#Table.Count>0 is True
-
Drag & Drop Action block
-
Click + Add Action
-
Select Create
-
Variable: totalNA
Value: filter(#Form#Table#Attendance ==‘N/A’) -
Click + Add Action
-
Select Create
-
Variable: newLen
Value: len(#Form#Table) - #totalNA.Count
- Drag & Drop For block
- Input For: #Form#Table
Input each: line - Drag & Drop Condition block
- Input #line#Attendance=='N/A’
#line#Attendance=='N/A' is True
-
Drag & Drop Action block
-
Click +Add Action
-
Variable: #Form#Average
Value: #Form#Total / #newLen
-
Drag & Drop Action block
-
Click +Add Action
-
Variable: #Form#Average
Value: **#Form#Total / len(#Form#Table)
Output to Calculate Average Without N/A row