Filter and Sum Bundle by product and by date

:bullseye: What is your goal?

Get the Sales for each month, without consumes too much credits

:thinking: What is the problem & what have you tried?

After an API call, I retrieve an array of collections. Each collection represents a sale with specific properties, notably “product” and “Salesdate”.

I want to group them by product (there are only two possible types) and by sales month in order to retrieve the figures afterwards. I found a solution using date filters after an Iterator and a Numeric Aggregator, but I have to run the API call for each date, which consumes a lot of operations/credits.
I am also considering a solution with 24 branches (one for each month of 2025 and 2026), but that doesn’t seem optimal to me.

How can I optimize this?

:link: Create public scenario page

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Yooo mate, you left your API key exposed. I deleted the link to the scenario. Please don’t do that.

Switch to the new HTTP module and use the connections instead of leaving the key inside the module.

For the question itself. Can you check the API documentation of the endpoint you are reaching to see if you can make different calls to get more of the data? Cause getting all orders for the day and having to do that 30 or 31 times for each month is excesive.

thanks for Api key

I get all the sales in One Api call. But i try to merge them after by month of sales

If you are getting all of them in one call, then you can use the Group By function in the aggregator to combine them in different arrays based on the month.

Yes this is what i have just done, but i cant manage to sum by value

Can you show how the modules are configured and what the input data looks like?

Ok but why are you grouping them by the date? That is not doing anything since they have different dates. Group them by the month instead using a formatDate function. Then you can sum them by month and get the totals.

Yes, grouping by month fixes the date part. One detail from Yann’s screenshots though: he also needs separate totals for each product.

I would skip the Array Aggregator here and place a Numeric Aggregator directly after the Iterator:

Value: value
Function: SUM
Group by: product + | + formatDate(salesDate; "YYYY-MM")

That way it gives him one output bundle per product and month, for example voucher|2026-07, from the same API response. So there’s no need for extra API calls or monthly branches.