Sum of value in collection inside a collection

Hello, I have to sum certain values from this output.
More specific: Amount + fx (18.61+0.37)

The problem is that I can get an array of multiple collection. I have a formula that can sum all “amount” values of all collections, but I can’t figure how to combine it with the “fx” value which is in another collection (“fees”).

This is the formula I got now:
image

Hi @Davidof90,

To sum the “amount” and “fx” values from your output, you can use the map function twice. First, you can use it to create an array of just the “value” values from each collection. Then, you can use it again to create an array of just the “fx” values from the “fees” collection. Once you have those two arrays, you can use the sum() function to calculate the total for each array. Finally, you can add the two totals together to get the overall sum of “amount” and “fx” values. This can be done by using the + operator to add the two results or using the sum() function. I tried with the sum() function.
{{sum(sum(map(2.items; "value")); sum(map(2.items; "sub.fx")))}}

I reconstructed your use case in my instance and this is my result:

Glenn - Callinetic

2 Likes

Awesome, thank you @Callinetic for the thourough and quick reply!

1 Like