Aggregating multiple variables

What I want to do

taking the avg of multiple value variables A, B, C

What I did

I could do this as

countA as count(val(A))
countB as count(val(B))
countC as count(val(C))
avgA as avg(val(A))
avgB as avg(val(B))
avgC as avg(val(C))
final_result: math( (avgA*countA+avgB*countB+avgC*countC)/(countA+countB+countC))

but I’m hoping for something simpler, like :
final_result: avg(A, B, C)
which doesn’t work

This looks like a very complex goal. You won’t get anything alone. Please share more context, with the dataset sample and examples of results you need. Based on the dataset and desire results I can evaluate if it is possible or not. And then if not so, I could recommend another workaround.

Also, an explanation of the intention behind such a query would help.