Split an array and basic maths

Hi, I am struggling to figure my problem out.

I would like to create an automation where when an invoice from Xero is created I can extract the line items, then multiply the Unit price by Quantity, then combine the the total with another line item that has gone through the same steps and then add it to a field in Notion so I can track.

My example is that I do freelance work on a full day and half day rate. I also include my super to be paid, as they pay for it. So an invoice can have 4 line items at a time. 2 for day rate, and 2 for super. The super has a 100% discount as I am not adding it to the total. It is there for reference.
So I would like to multiply the the amount and quantity in the “Full Day Super Rate” row, as well as the “Half Day Super Rate”, then combine the two for a total.

I can split the line item into seperate bundles with an iterator. It gives me 4 bundles with all the correct information.

Where I am struggling is saying “get bundle 3” (the full day super) to do the calculation first, then “get bundle 4” (the half day super) to do a calculation, then add together. I can filter the correct bundles out by searching for the “Item Code” from Xero as these will always be the same.

Any help will be greatly appreciated. Thank you!

Hi @Hot_Dammn,

I am not clear on exactly what you want, but assuming this is something you want, i.e Sum the Unit price By Quantity.

What, you can do is,

  • After the Iterator, Add Numeric Aggregator(it will be under Tools)
  • Do Multiplication of Quantity and Unit Amount

After that, you can use the resultant sum to send it to Notion. Just make sure that you have filter in between Iterator and Numeric Aggregator to ignore unwanted line items.

Hi @Runcorn ,

Thank you for your help. Sorry I couldn’t explain it well. I was struggling to type it out even!

What you have suggested worked! Thank you so much.