Sum of items in one array depending on what's in another array

How can I create a sum of items in one array depending on what is written in another array?

My example (see screenshot): I like to make a separate sum of xp for each category.
→ Player 1 shall have 30xp in Cooperation and 0xp in Battle and 0xp in Knowledge
→ Player 2 shall have 0xp in Cooperation, 40xp in Battle and 40xp in Knowledge

How can I achieve that?

Assuming you have that data available, what’s your next step? Do you want to use a rollup somewhere to sum the xp for each category?

Exactly. I want to show a chart where the user can see how many xp in each category he has.

And some more information:

  • the date in the screenshot comes from a log table
  • in the log table each row contains the category of the challenge, the xp, the username of the initiator and the usernames of all participants
  • all players (initiator and participants) shall receive xp

Here’s a screenshot from the log table:

Column 1: category
Column 2: email initiator
Column 3: emails of all other participants
Column 4: points that those people receive for doing the challenge

Wouldn’t it be better to create separate relations or queries specific to each category? Then you could add a Rollup for each category to sum the total.

1 Like