Error using subitem summary in formula when there is no subitems

Hello,

I’m using the subitem summary to show the total cost of the subitem. I then want to deduce that amount from the budget of the item. When I have a subitem, the formula works fine, but when I don’t have one yet. The formula shows an error instead of the total budget.
image

I tried using an IF({Réel CAN 2022}="",X,Y) but it’s like Réel CAN 2022 does not exist for that line if there is no subitem.

Any idea ?

Dominic