For unposted variables, formula variables are only executed with a replacement path if they are executed after aggregation.
A replacement is not executed from an attribute, for example. However, a replacement from hierarchy attributes is executed, because these are executed after aggregation.
Note
For a replacement from hierarchy attributes, remember that a hierarchy must be active or must exist on the characteristic.