I have dt_duration predicates in my data and I want to calculate the average duration from all my data. when I passed dt_duration to function avg doesn’t work for me so I think about this solution
{
var(func:has(dt_evt_name)) {
c as count(uid)
d as dt_duration
}
dt(){
dr as sum(val(d))
average as math(dr/c)
}
q(func: has(dt_evt_name),orderdesc: val(average)){
dtt : val(average)
}
}
I get error “message”: “: Wrong types 2, 0 encontered for func /” can anyone help to get the right code for this feature