How to use math in a function?

Math functions operate on query variables (docs). Here’s an example based on your post, using a var block as well:

{
  var(func: type(Commitment)) {
    a as Commitment.amount
    i as Commitment.intervals
    m as math(a * i / 12)
  }

  node(func: gt(val(m), 100)) {
    uid
  }
}
1 Like