Any guidance an producing a UDF aggregate function so that when used in a grouping query, it will return results based on how many values in the group. I know the aggregate function needs to return an int but not sure how to pass the values (which vary) into it... Not a scalar type and not sure if and how it would constitute a tabular type.
E.g how would I build a udf function for average...