Average by sub-type

I’m trying to create a virtual column that gives an average score for each user based on a sub-group categorization in another column. In the screenshot below, the first four columns are from my actual spreadsheet, the last two columns, Progress and Category Ave, are hard entered to illustrate what I’m trying to accomplish. The Category Ave column represents the virtual column I’m trying to create- an average of the Progress column per Category type.

What I have so far-
AVERAGE(SELECT(Goal[Progress],
AND([User]=[_THISROW].[User],
…???
))

Struggling to see the light…

Solved Solved
0 29 1,179
1 ACCEPTED SOLUTION

Need a bit of complex workaround to achieve your goal, but this is surely doable.

First, please prepare the new single independent table where you have two fields, user , category. This table is prepared for the purpose of distinct set of User-Category combination. For this table, select both column as key value then save the setting. Then I believe Appsheet will generate the auto fields as key, where the combination of two field value is made as key of this table.

Then, Create action on the table where you record all the activities, where have user and category value per row. The required action is add new row to another table using value from this row. Pass the value of user and category only to the table you just create above, and place ths action “On save” of the form of the table.

Upon creating and editing the form to record of the activities, the action is fired and add row to new table. In case there are exisiting row storing the same value, combination of user and caregory, then Appsheet should overwrite the existing value as both share the same key value. This stay the new table holding unique set of user+category all the time.

Then for this newly created table, add virtual column

AVERAGE(SELECT(Goal[Progress], AND([User]=[_THISROW].[User],[Category]=[_THISROW].[Category]))

I believe this will fields the values what you want.

View solution in original post

29 REPLIES 29
Top Labels in this Space