Sum item total by category in repeated list

Hello All,

I am new to Appgyver and having some issues trying to sum item amount by category in a repeated list and hope someone could provide some pointers.

I have a list with 3 properties i.e. Category, Icon and Amount for which I need to group by category and compute the total Amount under each category. I have tried using the GROUP formula below to group by category but having problems with grouping formula to compute the total amount by category.

GROUP(data.SBexpenseList, item.Category, {categoryName: key, icon: items[0].Icon, amount: INTEGER(SUM_BY_KEY(data.SBexpenseList, “Total”))})

Appreciate any help or advice.


make sure to check that you’re using “items” in the sum_by_key function to only sum over the current group, something like this might work:

GROUP(data.SBexpenseList, item.Category, { categoryName: key, icon: items[0].Icon, amount: INTEGER(SUM_BY_KEY(items, “Amount”))})

Thanks @Vili for your kind response but unfortunately it didn’t work and returns “null” on web preview, see screenshot below:


can you check if all your “total” fields have values in them? If so, are they correctly interpreted as numbers? If not, you can try the following:
instead of SUM_BY_KEY(items, “Amount”)
do SUM(MAP(items, NUMBER(item.Amount)))

This should make sure that all summed items are truly numbers.

1 Like

Thanks @Vili, it works now with the updated formula.