Did you know that all of the formulas you can access at the metric set level are also available to you within the data cube layer via the calculated element transform?
To use those formulas, simply type in the formula name within your calculated element script using a similar syntax to the one used in the formula editor within the metric set.
Happy data transformations!