Sum line item quantities from xero invoices

Hi all!

A simple thing for someone that knows what they’re doing (haha):
I just want to search xero invoices from past 60 days and sum the total quantity for each item. I am getting totally wrapped around the axel with iterators, aggregators, and array functions… but still no simple answer.

lets say we sell 3 different widgets. I just want a sum of qty invoiced for each widget within a 60 day time period.

simple. right?

any help is greatly appreciated!!!

i can get to an iteration of arrays that each contain the qty…but how do I sum the quantities up to a total??

Here is the approach you can try:

  • Use the “Search Invoices” module in Make,com to retrieve invoices from Xero. Set the filter to get invoices from the past 60 days.
  • Add an “Array Iterator” module to loop through each invoice retrieved in the previous step.
  • Inside the array iteration, use the “Split Text” or other appropriate modules to extract line items (items sold) from the current invoice.
  • Add another “Array Iterator” module to loop through each line item extracted from the invoice.
  • Inside the second array iteration, use the “Aggregator” module to sum up the quantities for each item. You can use the item name or a unique identifier as a key for aggregation.
  • After the iterations, you will have aggregated quantities for each item. You can format this data and output it as needed, such as writing it to a Google Sheet or sending notifications.

Best Regards


Thanks for the help! What i ended up doing was

  1. search for invoices based on my criteria
  2. iterate through line items
  3. aggregate on the Xero Item Code
  4. then finally when I write to google sheet I used: {{sum(map(13.array; “Quantity”))}} with 13.array being the aggregator module in the previous step

Hey @Noah :wave:

Just thought I’d hype you up for the solution you found to the troubles you were dealing with. Great to see that you were able to figure this out. :muscle:

FYI I marked your suggestion as a solution for other Makers to see. This way we keep the community neat and tidy for other users while they search for solutions to similar issues.

Keep up the great work :seedling:

1 Like