Metric definitions based on other calculated metrics

In an AQL dataset, can I use reference other metrics in metrics definitions? For example, we calculate LTV as ARPA/Churn Rate. We have another calculation for CAC. Further downstream we have a calculation for LTV:CAC ratio. I would like to not have to copy and paste everything from the upstream metrics definitions if possible. Not sure if I’m missing something in the docs or autocomplete but it doesn’t seem to be an option…

Hi Ian,

Thank you for trying out AQL.

You should be able to reuse the defined metric in a dataset internally. For example:

metric total_value {
  label: 'Total Value'
  type: 'number'
  hidden: false
  definition: @aql sum(order_items.value);;
}

metric total_spent {
  label: 'Total Spent'
  type: 'number'
  definition: @aql total_value;;
}

Not sure if I’m missing something in the docs or autocomplete but it doesn’t seem to be an option…

Could you let us know what is the issue you’re facing so we could provide further supports?

Oh wow, really simple. I couldn’t see that documented anywhere but that works perfectly.
Thanks!