Average of linked table column


#1

Hi there,

I have a table with player points per game. Games are split by rows while points sit in a column.

In another table I want to work out the average points per game for that player.

From reading online I think ‘Rollup’ is what I should be trying. I get stuck as I seem to have to specify a record in the linked table in order to return any result - however obviously this means what I’m returning the average of one cell (which is not what I want).

The table design is as follows

Player table

Game | Points
A | 10
B | 20

Player career table

Average points per game
15 (this is calculated from the previous table)

Bonus point for telling me how to also calcluate ‘Most points scored in one game’ in the ‘Player career table’.

Many thanks :slight_smile:
Thomas


#2

No, you are getting the Average of all values of that field for all linked Records.

So if you have Player A, linked to Game A, Game B and Game C, with points 10, 15, and 17, the Rollup field in Players A will give you 14, which is the average of those 3 numbers.


#3

Thanks Elias - this put me on the right track. I wanted to avoid manually linking to each new record, which I couldn’t work out how to do until I stumbled upon realising that duplicating a record means that it’s added to the linked record by default (note that creating a new record doesn’t do this).

Anyways, thanks.


#4

What do you mean? :thinking:

I create new linked records from Table A inside Table B. So I am entering a new Player, y create his Games from his own Record.


#5

If I press + here:

and add ‘Match 3’ manually, ‘Match 3’ doesn’t automatically appear in a linked table:

(I wanted to put a screenshot here but the platform won’t let me post more than one image.)

However, if I duplicate the ‘Match 2’ record here:

(I wanted to put a screenshot here but the platform won’t let me post more than one image.)

it does automatically add ‘Match 3’ here:

(I wanted to put a screenshot here but the platform won’t let me post more than one image.)

I’m happy with the latter.

Thanks for your help.


#6

You can’t have “default linked records”. You can duplicate one of the previous (I do it a lot :sweat_smile:), or you can Group in the PlayerMatch table by Match, so when you are creating a Match and adding the Players, you only add the relation once, and if you create a new Match, you only have to link the first Player.

I think you have something like this:


#7

Thanks, haven’t tried grouping before