However, when I create the calculated field for the measure parameter using ifelse, I see the following error: “The calculation operated on Level Aware Calculation (LAC) agg expressions is not valid.” Is there a workaround to this?

{_total_cost} and {_impressions} are both calculated fields with the MAX() calculation partitioned over the same fields, {_custom_conversions} is a MAX() calculation partitioned over a different set of fields, and {_custom_cpa} = sum({_total_cost})/sum({_custom_conversions})

The limitation appears to be when including calculated fields in the DynamicMeasure calculated field that are a mixture of both aggregate and LAC functions.

In my example above, MaxProfitLAC is a LAC max() function, while MaxSales is an normal aggregate max() function.
Only if both calculated fields use the same type of function, both aggregate max(), or both LAC max(), then the calculated field is valid (noting that the LAC function grouping keys must be the same).