Aleksis Andersonsd
 · Founder @ Bill

Data aggregation via for each loop

Answered

Hello,

I have a table with receipt data (amount, shop, etc.); a table with item data (purchased item, price, quantity, etc.) and item category table (fruits, dairy, etc.) that is referenced to each item.

What I am trying to do now is to aggregate data so I can show some meaningful analysis (a summary) on the front end like how much of each category you have purchased this month.

I am able to querry receipts for the current month, then run a for each loop through each receipt to aggregate (sum) item values & categories via addon.

This gives me an aggregated purchases per category in each receipt. However, as it is a for each loop in the results I am only returned the last loop.
Is it possible somehow to now aggregate the results for all loops together? Meaning, to once again aggregate all of categories & total value (price) from all loops together?

What I am looking for is to show all purchase categories & their total values (price) for all receipts in current month.

6 replies