Hi Meteusz,
certainty you can use transformations in macros. Please see documentation.
I haven't tested hierarchical transformation though. What exactly are you trying to achieve? Did you consider another approach? E.g. Prepare your data with custom query?