Summing columns in a collection

So I have a collection, call it Fines.

Collection - Fines

  • NAME | AMOUNT

  • Tom | $20.00

  • Bill | $30.00

  • Mike | $60.00

  • Tom | $20.00

  • Bill | $30.00

  • Mike | $60.00

I want to sum the total items by Name, to another collection, like below.

Collection - Fine Totals

  • NAME | TOTAL

  • Tom | $40.00

  • Bill | $60.00

  • Mike | $120.00

Is there an easy way to do this?

Hi Anthony,

Have a look at the aggregate API here
https://www.wix.com/velo/reference/wix-data/wixdataaggregate

You most likely are looking to use it along with the .filter() and .sum() functions.

Thanks you very much! I’ll have a look.