If you need to calculate the values and store them, then creating an attribute in the entity that you populate with a Before Commit event microflow is usually a good approach.
So in your example, if you need to calculate Z based on the W attribute, just place your calculation in the Before Commit microflow for the entity and Change the entity to set Z, but don’t commit again else you’ll be stuck in an infinite loop.
Hope this helps.