Dataview query - Summing attribute values

So I am looking to get the sum of 2 separate attributes. One is ‘Balance’ and one is ‘Valued’. I figured out how to display one of them on its own but dont know how to display the sum of the 2 of them. They both have multiple values pulled from different notes with the #loan tag. See query below which display the sum of all the ‘BAlance’ attributes. I want to get the sum of them displayed but cant figure out the formula. Please help!


dv.paragraph("€" + dv.pages("#loan")

.Balance.array().reduce((acc, val) => acc + val, 0))


<!-- THIS PART WON'T BE POSTED

We strongly recommend searching in the help docs (F1 in the app or online at https://help.obsidian.md) or this forum (https://forum.obsidian.md/search) before you post. It's always sweet to find answers so you don't have to spend time writing up the post!

If you still can't find it, please write what you have tried below (e.g. "I searched Mermaid in help docs but couldn't find anything") so that we have a better idea how to improve our help docs and this forum.

Please continue below this line: -->



### What I'm trying to do

<!-- THIS PART WON'T BE POSTED

Please describe what you're trying to accomplish so the community can better help you. Sometimes the solution you have in mind is not necessarily the best option, in which case knowing some background info can let others come up with creative solutions for your use case.

Please continue below this line. -->
1 Like