---
title: "Calculate rolling summation or subtraction between parent and child fields"
canonical: "https://support.appfire.com/space/PSJ/15482592/Calculate%20rolling%20summation%20or%20subtraction%20between%20parent%20and%20child%20fields"
format: markdown
---
> Macro (aura-html)

 

This script retrieves values from the **Expense** field in the issue subtasks, and then subtracts them from the budget.

##### RollingFieldSummationParentChild.sil script

```
string [] stasks = subtasks(key);
int budget = customfield_10714;

if(isNotNull(budget)) {
    for(string s in stasks) {
        if(isNotNull(%s%.customfield_10713)) {
            budget = budget - s.customfield_10713;
        }
    }
}

return budget;
```