Sum of an array calculation

I’m having a little trouble getting the sum of each line items in an invoice. In the array I have a unit price and a quantity. I want to multiply these the get the sum in the array.

In this example I should be getting:
2525 x 1 = 2525
5.99 x 864 = 5175.36
total = 7700.36

Here is my test in a google sheet:

{{sum(72.array.SalesItemLineDetail.UnitPrice * 72.array.SalesItemLineDetail.Qty)}}

Welcome to the Make community!

1. Screenshots of module fields and filters

Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:
Screenshot_2023-10-07_111039

2. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

3. And most importantly, Output bundles

Please provide the output bundles of the modules by running the scenario, then click the white speech bubble on the top-right of each module, save the bundle contents in your text editor as a bundle.json file, and upload it here into this discussion thread.
Screenshot_2023-10-06_141025

Providing the output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

2 Likes

Hi @Shawn

Use iterator to iterate the array and text aggregator to aggregate the result of (Unitprice*Qty) and sum the result.
Input:


Output:


If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

3 Likes

I just got it to work with the numeric aggregator. The text aggregator gave me a very different number. Thank you for pushing me in the right direction.

2 Likes

Hello @Shawn :wave:

just wanted to pop in and pat you on the back for the great job you did while figuring out this puzzle with @samliew’s and @Msquare_Automation’s help.

Thank you for coming back here and sharing the final solution in the thread. We appreciate you keeping our community neat and tidy :broom:.

Keep up the awesome work!

2 Likes