---
title: "Calculating cumulative sum of basal area"
url: "https://openforis.support/questions/32/calculating-cumulative-sum-of-basal-area"
tags: ["collect"]
status: "accepted"
score: 0
answer_count: 1
asked: "2014-10-09T21:01:12"
last_activity: "2014-10-09T21:42:55"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Calculating cumulative sum of basal area

Asked by Andras on 2014-10-09

Hi!

How can I calculate the cumulative sum of a set of attributes with basal area?

Thanks!


## Accepted answer (score 0, by Stefano (OF) on 2014-10-09)

Link: https://openforis.support/questions/32/calculating-cumulative-sum-of-basal-area/37

Suppose that you have an entity called "tree", a calculated attribute inside of it "tree_num" with the position of the tree (**idm:position()** expression can be used), and a calculated attribute for the basal area, we can call it **ba** for example, then you can sum the basal area of the previous inserted trees with an expression like this: **sum(parent()/tree[tree_num < $this/parent()/tree_num]/ba)**.
Thanks
